Documentation ¶
Index ¶
- Variables
- type Command
- func (c *Command) AddBoolParameter(parameter *Parameter, value *bool, defaultValue bool) *Parameter
- func (c *Command) AddCommand(command *Command) *Command
- func (c *Command) AddIntParameter(parameter *Parameter, value *int, defaultValue int) *Parameter
- func (c *Command) AddStringParameter(parameter *Parameter, value *string, defaultValue string) *Parameter
- func (c *Command) Do(handler func(cmd *Command))
- func (c *Command) FindCommand(name string) (*Command, bool)
- func (c *Command) FindHelp(args []string) (*Help, error)
- func (c *Command) GetBool(name string) (bool, error)
- func (c *Command) GetInt(name string) (int, error)
- func (c *Command) GetString(name string) (string, error)
- func (c *Command) Help() *Help
- func (c *Command) Parse(args []string) (*Command, error)
- func (c *Command) Run() error
- type Commands
- type Help
- type Parameter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCommandHandlerNotFound = errors.New("command's handler function is not found")
View Source
var ErrCommandNotFound = errors.New("command is not found in configurator's commands")
View Source
var ErrParameterIsNotBool = errors.New("wanted parameter is not a boolean")
View Source
var ErrParameterIsNotInt = errors.New("wanted parameter is not an integer")
View Source
var ErrParameterIsNotString = errors.New("wanted parameter is not a string")
View Source
var ErrParameterNotFound = errors.New("wanted parameter is not found")
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Name string Use string Description string Parameters []Parameter Commands Commands Flagset *flag.FlagSet // contains filtered or unexported fields }
func (*Command) AddBoolParameter ¶
AddBoolParameter sets a bool flag in the command's flagset
func (*Command) AddCommand ¶
AddCommand adds sub commands to the command
func (*Command) AddIntParameter ¶
AddIntParameter sets an int flag in the command's flagset
func (*Command) AddStringParameter ¶
func (c *Command) AddStringParameter(parameter *Parameter, value *string, defaultValue string) *Parameter
AddStringParameter sets a string flag in the command's flagset
func (*Command) FindCommand ¶
FindCommand searches the sub commands of the command
func (*Command) FindHelp ¶ added in v0.0.4
FindHelp recognizes if any help command is received and returns a help
func (*Command) GetString ¶
GetString gets a string value with the given name from the command's flagset
Click to show internal directories.
Click to hide internal directories.