Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUsage is really no error, but signals that help text should be printed. ErrUsage = errors.New("unknown options") // ErrNoCommand is a warning that no command was supplied. ErrNoCommand = errors.New("no command specified") )
Functions ¶
func HandleCommands ¶ added in v0.2.0
func HandleCommands(options interface{}) error
HandleCommands is a shortcut for handling commands and outputting usage test, returning any serious errors.
Types ¶
type Args ¶
Args gets options and commands parsed into it.
func (*Args) SetChoicesLong ¶
SetChoicesLong sets the selectable options based on the long option name.
func (*Args) SetChoicesShort ¶
SetChoicesShort sets the selectable options based on the short option name.
type DefaultHelp ¶
type DefaultHelp struct {
Help bool `short:"h" help:"Show this help."`
}
DefaultHelp can be embedded in your options struct to save some typing.
type Flag ¶
type Flag struct {
Name string
Help string
Short string
Long string
Group string
Placeholder string
CommandName string
Default string
Choices []string
Aliases []string
Args *Args
IsCommand bool
IsSlice bool
IsMap bool
Required bool
// contains filtered or unexported fields
}
Flag or command option.
func (*Flag) AddChoice ¶
AddChoice to list. Makes the choice lowercase and trims leading and trailing spaces.
func (*Flag) UsageString ¶
UsageString returns the help text.
Click to show internal directories.
Click to hide internal directories.