Documentation
¶
Index ¶
- type ANSICode
- type Parser
- func (ap *Parser) AddCommand(name string, help string) error
- func (ap *Parser) AddFlag(name string, help string, abbr rune) error
- func (ap *Parser) AddOption(name string, help string, abbr rune, defaultsTo string, allowed []string) error
- func (ap *Parser) Help()
- func (ap *Parser) Init(name string, description string)
- func (ap *Parser) Parse() (*Results, error)
- type Results
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANSICode ¶
type ANSICode string
const ( ANSIDefault ANSICode = "\033[39m" ANSIBGDefault ANSICode = "\033[49m" ANSIBlack ANSICode = "\033[30m" ANSIRed ANSICode = "\033[31m" ANSIGreen ANSICode = "\033[32m" ANSIYellow ANSICode = "\033[33m" ANSIBlue ANSICode = "\033[34m" ANSIMagenta ANSICode = "\033[35m" ANSICyan ANSICode = "\033[36m" ANSIWhite ANSICode = "\033[37m" ANSIBGBlack ANSICode = "\033[40m" ANSIBGRed ANSICode = "\033[41m" ANSIBGGreen ANSICode = "\033[42m" ANSIBGYellow ANSICode = "\033[43m" ANSIBGBlue ANSICode = "\033[44m" ANSIBGMagenta ANSICode = "\033[45m" ANSIBGCyan ANSICode = "\033[46m" ANSIBGWhite ANSICode = "\033[47m" )
type Parser ¶
type Parser struct {
/// Return an error if the first argument isn't a command. Ignored if no
/// commands have been added
CommandRequired bool
/// Header displayed by the `Help` function before the command descriptions
CommandsHelpMsg string
/// Header displayed by the `Help` function before the flag descriptions
FlagsHelpMsg string
/// Header displayed by the `Help` function before the option descriptions
OptionsHelpMsg string
/// Color the output of the `Help` function
Colors bool
/// Color of the title outputed by the `Help` function
TitleColor ANSICode
/// Color of the description outputed by the `Help` function
DescriptionColor ANSICode
/// Color of the headers outputed by the `Help` function
HeaderColor ANSICode
/// Color of the command names outputed by the `Help` function
CommandColor ANSICode
/// Color of the command's description outputed by the `Help` function
CommandDescriptionColor ANSICode
/// Color of the flag names outputed by the `Help` function
FlagColor ANSICode
/// Color of the flag's description outputed by the `Help` function
FlagDescriptionColor ANSICode
/// Color of the option names outputed by the `Help` function
OptionColor ANSICode
/// Color of the option's description outputed by the `Help` function
OptionDescriptionColor ANSICode
/// Color of the option's allowed values outputed by the `Help` function
OptionAllowedColor ANSICode
// contains filtered or unexported fields
}
func (*Parser) AddCommand ¶
/ Add a command / @param name command's name / @param help command's description / @return Error if the command already exists
func (*Parser) AddFlag ¶
/ Add a flag / @param name flag's name / @param help flag's description / @param abbr flag's abbreviation / @return Error if the flag already exists
func (*Parser) AddOption ¶
func (ap *Parser) AddOption( name string, help string, abbr rune, defaultsTo string, allowed []string, ) error
/ Add an option / @param name option's name / @param help option's description / @param abbr option's abbreviation / @param defaultsTo option's default value / @param allowed option's allowed values. Doesn't necessarily need to contain the default value / @return An error if the option already exists
Click to show internal directories.
Click to hide internal directories.