Documentation
¶
Index ¶
- Variables
- func AliasedBoolVar(fs *flag.FlagSet, p *bool, names string, value bool, usage string)
- func AliasedFloat64Var(fs *flag.FlagSet, p *float64, names string, value float64, usage string)
- func AliasedInt64Var(fs *flag.FlagSet, p *int64, names string, value int64, usage string)
- func AliasedIntVar(fs *flag.FlagSet, p *int, names string, value int, usage string)
- func AliasedStringVar(fs *flag.FlagSet, p *string, names string, value string, usage string)
- func AliasedStringsVar(fs *flag.FlagSet, p *[]string, names string, usage string)
- func IsPassed(fs *flag.FlagSet, names string) bool
- func Run(app *Command) error
- type Command
- type ParseExecFunc
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidCommandName = errors.New("invalid command name") ErrNoExecFunc = errors.New("exec function undefined") ErrCommandNotFound = errors.New("command not found") )
flagx defined inner errors
Functions ¶
func AliasedBoolVar ¶
AliasedBoolVar defines a bool flag with specified names, default value, and usage string. The specified usage string is used for the primary flag name only. The usage string of a secondary flag name specifies that it is an alias of the primary name. The argument p points to a bool variable in which to store the value of the flag.
func AliasedFloat64Var ¶ added in v0.1.1
AliasedFloat64Var defines an float64 flag with specified names, default value, and usage string. The specified usage string is used for the primary flag name only. The usage string of a secondary flag name specifies that it is an alias of the primary name. The argument p points to an float64 variable in which to store the value of the flag.
func AliasedInt64Var ¶ added in v0.1.1
AliasedInt64Var defines an int64 flag with specified names, default value, and usage string. The specified usage string is used for the primary flag name only. The usage string of a secondary flag name specifies that it is an alias of the primary name. The argument p points to an int64 variable in which to store the value of the flag.
func AliasedIntVar ¶
AliasedIntVar defines an int flag with specified names, default value, and usage string. The specified usage string is used for the primary flag name only. The usage string of a secondary flag name specifies that it is an alias of the primary name. The argument p points to an int variable in which to store the value of the flag.
func AliasedStringVar ¶
AliasedStringVar defines a string flag with specified names, default value, and usage string. The `names` argument is the comma separated aliases of the flag. The specified usage string is used for the primary flag name only. The usage string of a secondary flag name specifies that it is an alias of the primary name. The argument p points to a string variable in which to store the value of the flag.
func AliasedStringsVar ¶
AliasedStringsVar defines a []string flag with specified names, and usage string. The specified usage string is used for the primary flag name only. The usage string of a secondary flag name specifies that it is an alias of the primary name. The argument p points to a []string variable in which to store the value of the flag. Note: no default value is given.
Types ¶
type Command ¶
type Command struct {
SubCmd map[string]*Command // sub-commands of the command
ParseExec ParseExecFunc // function to be executed by the command
}
Command represents a node of the commands tree. Each node has the function to be called if the command is executed and the children sub-commands.
type ParseExecFunc ¶
ParseExecFunc is the signature of the function that is called when a Command is executed.
cmdfullname: the full name of the command (example: "app cmd subcmd") arguments: the arguments of the command