Documentation ¶
Overview ¶
Package cli provides utilities for happy command line interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCommandInvalid = errors.New("invalid command definition") ErrCommandArgs = errors.New("command arguments error") ErrCommandFlags = errors.New("command flags error") ErrPanic = errors.New("there was panic, check logs for more info") )
View Source
var ( FlagVersion = varflag.BoolFunc("version", false, "print application version") FlagHelp = varflag.BoolFunc("help", false, "display help or help for the command. [...command --help]", "h") FlagX = varflag.BoolFunc("x", false, "the -x flag prints all the cli commands as they are executed.") FlagSystemDebug = varflag.BoolFunc("system-debug", false, "enable system debug log level (very verbose)") FlagDebug = varflag.BoolFunc("debug", false, "enable debug log level") FlagVerbose = varflag.BoolFunc("verbose", false, "enable verbose log level", "v") )
Common CLI flags which are automatically attached to the CLI ubnless disabled ins settings. You still can manually add them to your CLI if you want to.
Functions ¶
func AskForConfirmation ¶
AskForConfirmation gets (y/Y)es or (n/N)o from cli input.
func AskForInput ¶
Types ¶
type Settings ¶ added in v0.24.0
type Settings struct { MainMinArgs settings.Uint `default:"0" desc:"Minimum number of arguments for a application main"` MainMaxArgs settings.Uint `default:"0" desc:"Maximum number of arguments for a application main"` WithoutConfigCmd settings.Bool `default:"false" desc:"Do not include the config command in the CLI"` WithoutGlobalFlags settings.Bool `default:"false" desc:"Do not include the global flags automatically in the CLI"` }
Click to show internal directories.
Click to hide internal directories.