Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cli ¶
type Cli struct { HelpMsg string // contains filtered or unexported fields }
Cli is a command interface. It executes the subcommand from its arguments list or a default command.
func (*Cli) Execute ¶
Execute checks the first argument and executes the matching sub-command if any. If no arguments are present it executes the Cli.defaultCmd. If the first argument does not match a sub-command it prints the Cli.HelpMsg.
func (*Cli) HandleDefault ¶
HandleDefault registers the default command to be executed if no arguments are given. If no arguments are given and Cli.defaultCmd == nil the Cli.HelpMsg will be printed.
func (*Cli) HandleDefaultFunc ¶
func (c *Cli) HandleDefaultFunc(handler cmdFunc)
HandleDefaultFunc registers a function to handle the default command to be executed if no arguments are given.
func (*Cli) HandleFunc ¶
HandleFunc registers a function to handle a given command.