Documentation ¶
Index ¶
- type Parser
- func (parser *Parser) AddInt(variable *int, name string, defaultValue int, description string, ...) error
- func (parser *Parser) AddOption(variable *bool, name, description string, opt ...string) error
- func (parser *Parser) AddPosInt(variable *int, name, description string) error
- func (parser *Parser) AddPosString(variable *string, name, description string) error
- func (parser *Parser) AddString(variable *string, name, defaultValue, description string, opt ...string) error
- func (parser *Parser) Args() []string
- func (parser *Parser) Description(desc string)
- func (parser *Parser) HasErrors() bool
- func (parser *Parser) Name(n string)
- func (parser *Parser) Parse(params ...string) error
- func (parser *Parser) Parsed() bool
- func (parser *Parser) PrintUsageAndExit(status int)
- func (parser *Parser) Reset()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents an argument parser
func (*Parser) AddInt ¶
func (parser *Parser) AddInt(variable *int, name string, defaultValue int, description string, opt ...string) error
AddInt ...
func (*Parser) AddPosString ¶
AddPosString adds a new positional string argument
func (*Parser) AddString ¶
func (parser *Parser) AddString(variable *string, name, defaultValue, description string, opt ...string) error
AddString adds a new string parameter.
func (*Parser) Description ¶
Description adds a description of the program, which will be displayed in the usage text
func (*Parser) Parse ¶
Parse tries to parse the arguments specified. If no is given, it uses os.Args.
func (*Parser) PrintUsageAndExit ¶
PrintUsageAndExit can be used if parsing os.Args
Click to show internal directories.
Click to hide internal directories.