Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ErrorUsage should be returned from tool commands to show its options. ErrorUsage = "unknown options" // ErrorNoCommand is also used internally when something breaks. ErrorNoCommand = "no command specified" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
Args gets options and commands parsed into it.
func Parse ¶
func Parse(data interface{}) *Args
Parse the command line for arguments and tool commands.
func (*Args) SetChoicesLong ¶ added in v0.10.0
SetChoicesLong sets the selectable options based on the long option name.
func (*Args) SetChoicesShort ¶ added in v0.10.0
SetChoicesShort sets the selectable options based on the short option name.
type DefaultHelp ¶ added in v0.2.0
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 ¶ added in v0.10.0
AddChoice to list. Makes the choice lowercase and trims leading and trailing spaces.
func (*Flag) SetChoices ¶ added in v0.10.0
SetChoices to a new list.
func (*Flag) UsageString ¶
Click to show internal directories.
Click to hide internal directories.