Documentation ¶
Index ¶
- Constants
- func GetTaskNames(taskField string) ([]string, error)
- func SingleQuantity(t string, elems ...string) []msg.Quantity
- func WarnUnused(args []string)
- type ArgHandler
- type Description
- type Param
- type ParamDescription
- type Parser
- func (p *Parser) Describe(what string) Description
- func (p *Parser) ParamDescription() []ParamDescription
- func (p *Parser) Parse(args []string) (msg.Cmd, error)
- func (p *Parser) TaskDescription() string
- func (p *Parser) WithArgHandler(h ArgHandler) *Parser
- func (p *Parser) WithMultipleTasks() *Parser
- func (p *Parser) WithSingleTask() *Parser
- func (p *Parser) WithoutParams() *Parser
- func (p *Parser) WithoutTask() *Parser
- type Quantifier
Constants ¶
View Source
const ( ParamIdentifierPrefix = ":" // TODO: Should it be a public constant here? Other options? Package-private? AllTasks string = ParamIdentifierPrefix + "all" )
Variables ¶
This section is empty.
Functions ¶
func GetTaskNames ¶
Split task names given as a comma-separated field, check for validity.
func WarnUnused ¶
func WarnUnused(args []string)
Warn the user about arguments being unevaluated. If args is empty, no warning is issued.
Types ¶
type ArgHandler ¶
type ArgHandler interface { // Parse the params and modify cmd accordingly. // Returns unused arguments and a possible error. HandleArgs(cmd *msg.Cmd, args []string) ([]string, error) // Whether the argument handler takes any parameters. TakesParameters() bool // Describe available parameters DescribeParameters() []ParamDescription }
func HandlerForParams ¶
func HandlerForParams(params []Param) ArgHandler
type Description ¶
type Param ¶
type Param struct { Name string RequiresArg bool Quantifier Quantifier Description string }
func (Param) Describe ¶
func (p Param) Describe() ParamDescription
type ParamDescription ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
TODO: Move methods to builder?
func CommandParser ¶
func (*Parser) Describe ¶
func (p *Parser) Describe(what string) Description
func (*Parser) ParamDescription ¶
func (p *Parser) ParamDescription() []ParamDescription
func (*Parser) TaskDescription ¶
func (*Parser) WithArgHandler ¶
func (p *Parser) WithArgHandler(h ArgHandler) *Parser
func (*Parser) WithMultipleTasks ¶
func (*Parser) WithSingleTask ¶
func (*Parser) WithoutParams ¶
func (*Parser) WithoutTask ¶
Click to show internal directories.
Click to hide internal directories.