Documentation ¶
Index ¶
- Variables
- func Main(module Module, commandModules ...Module)
- func NewApp(module Module, commandModules ...Module) *cli.App
- func NewCommand(module Module, usedModules ...Module) cli.Command
- func WrapAction(action cli.ActionFunc) cli.ActionFunc
- func WrapMainAction(action cli.ActionFunc) cli.ActionFunc
- type Actions
- type Module
- func (t *Module) AddDepend(modules ...*Module) *Module
- func (t *Module) AddFlag(flags ...cli.Flag) *Module
- func (t *Module) SetAction(action cli.ActionFunc) *Module
- func (t *Module) SetAfter(action cli.ActionFunc) *Module
- func (t *Module) SetBefore(action cli.ActionFunc) *Module
- func (t *Module) SetUsage(usage string) *Module
- type Modules
Constants ¶
This section is empty.
Variables ¶
var VersionModule = NewModule("version").
SetUsage("Show version detail").
SetAction(versionAction)
VersionModule provide module of version, Set nil to disable version command
Functions ¶
func NewCommand ¶
NewCommand return cli.Command with module
func WrapAction ¶
func WrapAction(action cli.ActionFunc) cli.ActionFunc
WrapAction wrap action with default error handler
func WrapMainAction ¶
func WrapMainAction(action cli.ActionFunc) cli.ActionFunc
WrapMainAction wrap main action with default error handler and command helper
Types ¶
type Actions ¶
type Actions []cli.ActionFunc
Actions slice of cli.ActionFunc
func (Actions) Wrap ¶
func (t Actions) Wrap() cli.ActionFunc
Wrap return wrapped function for running all actions with WrapAction
func (Actions) WrapMain ¶
func (t Actions) WrapMain(mainAction cli.ActionFunc) cli.ActionFunc
WrapMain return wrapped function for running all actions with WrapMainAction
type Module ¶
type Module struct { Name string Usage string Flags []cli.Flag Before cli.ActionFunc Action cli.ActionFunc After cli.ActionFunc Depend Modules }
Module for cli, used for cli.App or cli.Command
func (*Module) SetAction ¶
func (t *Module) SetAction(action cli.ActionFunc) *Module
SetAction set Module action
func (*Module) SetAfter ¶
func (t *Module) SetAfter(action cli.ActionFunc) *Module
SetAfter set Module after action
type Modules ¶
type Modules []*Module
Modules slice of Module
func (Modules) AfterActions ¶
AfterActions return all after actions in Modules
func (Modules) BeforeActions ¶
BeforeActions return all before actions in Modules
func (Modules) DependOnce ¶
DependOnce return all dependent modules but only show once if depend multiple times