cmd

package
v1.11.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Package cmd uses the Cobra package to provide and handle all the interactions with the command-line interface in Linux.

Index

Constants

View Source
const (
	About   = Title + " is the program to manage, maintain and optimise " + Domain + "."
	Author  = "Ben Garrett"                     // Author is the primary programmer of this program.
	Domain  = "defacto2.net"                    // Domain of the website.
	Program = "df2"                             // Program command.
	Title   = "The Defacto2 tool"               // Title of this program.
	URL     = "https://github.com/Defacto2/df2" // URL of the program repository.

)

Variables

View Source
var (
	ErrNoOutput = errors.New("no output command used")
	ErrPointer  = errors.New("pointer value cannot be nil")
)
View Source
var (
	ErrConfig  = errors.New("config cannot be empty")
	ErrCommand = errors.New("invalid command, please use one of the available commands")
	ErrID      = errors.New("invalid id or uuid specified")
	ErrLogger  = errors.New("logger cannot be nil")
	ErrNoID    = errors.New("requires an id or uuid argument")
)

Functions

func Arch

func Arch() string

Arch returns this program's system architecture.

func Brand

func Brand(w io.Writer, l *zap.SugaredLogger, b []byte) error

Brand prints the byte ASCII logo to the stdout.

func Commit

func Commit(version string) string

Commit returns a formatted, git commit description for this repository, including tag version and date.

func Copyright() string

Copyright returns the copyright years and author of this program.

func ExeTmpl

func ExeTmpl() string

ExeTmpl returns the template for the -version flag.

func Execute

func Execute(log *zap.SugaredLogger, c conf.Config) error

Execute is a Cobra command that adds all child commands to the root and sets the appropriate flags. It is called by main.main() and only needs to be called once in the rootCmd.

func LastCommit

func LastCommit() string

LastCommit returns the time and date of the last repo commit.

func OS

func OS() string

OS returns this program's operating system.

func ProgInfo

func ProgInfo(logr *zap.SugaredLogger, cfg conf.Config, version string) (string, error)

ProgInfo returns the response for the -version flag.

func Vers

func Vers(version string) string

Vers returns a formatted version. The version string is generated by GoReleaser.

Types

type ProgData

type ProgData struct {
	Database   string
	Ansilove   string
	Webp       string
	Magick     string
	Netpbm     string
	PngQuant   string
	Arj        string
	File       string
	Lha        string
	UnRar      string
	UnZip      string
	ZipInfo    string
	Version    string
	Revision   string
	LastCommit string
	Path       string
	Platform   string
	GoVer      string
	GoOS       string
	Docker     string
	Title      string
	Cmd        string
}

ProgData is used for holding the version flag template data.

Directories

Path Synopsis
internal
arg
Package arg has structures used to store the flag values used by the cobra.Command methods.
Package arg has structures used to store the flag values used by the cobra.Command methods.
run
Package run is a collection of work functions used by the cobra.Command methods.
Package run is a collection of work functions used by the cobra.Command methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL