Documentation ¶
Overview ¶
Private functions that helps Ezcli.
Index ¶
- type Command
- type CommandData
- type CommandHandler
- func (ch *CommandHandler) AddCommand(c *Command)
- func (ch *CommandHandler) AddCommands(cs []*Command)
- func (ch *CommandHandler) FindCommand(name string, fn func(c *Command) error) error
- func (ch *CommandHandler) Handle()
- func (ch *CommandHandler) SetName(name string)
- func (ch *CommandHandler) SetNotFoundFunction(fn func())
- type CommandOption
- type Question
- type SubCommand
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, Aliases []string
CommandData *CommandData
Execute func(c *Command)
SubCommands []*SubCommand
}
Command struct.
func (*Command) FindOption ¶
func (c *Command) FindOption(name string, fn func(o *CommandOption))
Find an option template from command.
func (Command) FindSubcommand ¶ added in v1.2.0
func (c Command) FindSubcommand(name string, fn func(sc *SubCommand)) error
Find Sub-command
type CommandData ¶
type CommandData struct { Arguments []string Options []*CommandOption }
Command Data struct (arguments, options...)
func (*CommandData) FindOption ¶
func (c *CommandData) FindOption(name string, fn func(o *CommandOption))
Find an option from command data.
type CommandHandler ¶
Command Handler struct.
func NewApp ¶ added in v1.2.0
func NewApp(appName string) *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) AddCommands ¶
func (ch *CommandHandler) AddCommands(cs []*Command)
Add more command to the handler.
func (*CommandHandler) FindCommand ¶
func (ch *CommandHandler) FindCommand(name string, fn func(c *Command) error) error
Find a command from handler.
func (*CommandHandler) SetName ¶ added in v1.2.0
func (ch *CommandHandler) SetName(name string)
Set App Name
func (*CommandHandler) SetNotFoundFunction ¶
func (ch *CommandHandler) SetNotFoundFunction(fn func())
Set error function that will run when command not found.
type CommandOption ¶
Command option (flag) struct.
type SubCommand ¶ added in v1.2.0
type SubCommand struct {
Name, Description string
Usages []string
CommandData *CommandData
Execute func(sc *SubCommand)
}
Sub-Command struct
Click to show internal directories.
Click to hide internal directories.