Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Name, Description string
Options []*CommandOption
Usages []string
CommandData *CommandData
Execute func(data *CommandData)
}
Command struct.
func (*Command) FindOption ¶
func (c *Command) FindOption(name string, fn func(o *CommandOption))
Find an option from command.
type CommandData ¶
type CommandData struct { Arguments []string Options []*CommandOption }
Command Data struct (arguments, options...)
type CommandHandler ¶
type CommandHandler struct {
Commands []*Command
}
Command Handler struct.
func CreateHandler ¶
func CreateHandler() *CommandHandler
Create a command handler with built-in help command.
func (*CommandHandler) AddCommand ¶
func (ch *CommandHandler) AddCommand(c *Command)
Add a new command to the handler.
func (*CommandHandler) FindCommand ¶
func (ch *CommandHandler) FindCommand(name string, fn func(c *Command) error) error
Find a command from handler.
type CommandOption ¶
type CommandOption struct {
Name, Description string
}
Command option (flag) struct.
Click to show internal directories.
Click to hide internal directories.