Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetachCommandFrom ¶
DetachCommandFrom function detaches the command from the string and returns it and its arguments
func MakeCommandMapFrom ¶
MakeCommandMapFrom function make the map from the command slice with the command alias as the key.
Types ¶
type Command ¶
type Command struct { Name string Alias string Summary string Usage string Example string SubCommands map[string]*Command Handler CommandHandler }
Command holds data about the command
func NewCommand ¶
func NewCommand( name string, alias string, summary string, usage string, example string, subCommands []*Command, handler CommandHandler, ) *Command
NewCommand is a constructor for Command
type CommandHandler ¶
type CommandHandler interface {
Handle(ctx *Context)
}
CommandHandler is an interface for command execution
type CommandHelpPresenter ¶
CommandHelpPresenter is the interface for displaying help messages for commands
type RouteHandler ¶
type RouteHandler struct { Command *Command HelpPresenter CommandHelpPresenter }
RouteHandler is a struct that implements CommandHandler
func (*RouteHandler) Handle ¶
func (rh *RouteHandler) Handle(ctx *Context)
Handle of RouteHandler calls the subcommand handle according to Argument
Source Files ¶
Click to show internal directories.
Click to hide internal directories.