Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHelp = errors.New("help")
ErrHelp can be returned by Execute functions to force the action to show help for a given command.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // Execute is the callback that'll be called to execute this action. Execute(ctx Context) error // Help is the help text for this action. Help() string // Synopsis is the text that will be shown as a short sentence // about what this action does. Synopsis() string }
Action defines an action that is available for the router.
type Context ¶
Context is passed to the router and used to select which action is executed. This same value will also be passed down into the selected Action's Execute function. This is so that actions typecast the context to access implementation-specific data.
type Router ¶
Router is a helper to route subcommands to specific callbacks.
Actions are available on a lot of commands such as dev, deploy, etc. and this can be used to add custom actions.
type SimpleAction ¶
func (*SimpleAction) Execute ¶
func (sa *SimpleAction) Execute(ctx Context) error
func (*SimpleAction) Help ¶
func (sa *SimpleAction) Help() string
func (*SimpleAction) Synopsis ¶
func (sa *SimpleAction) Synopsis() string
Click to show internal directories.
Click to hide internal directories.