Documentation ¶
Index ¶
- Variables
- func WrapAction(action func(context *cli.Context) error) func(context *cli.Context)
- func WrapActionLogger(action func(context *cli.Context) error, logger logutil.StdLogger) func(context *cli.Context)
- type BoolFunc
- type Manager
- func (t *Manager) AddCommand(command cli.Command) (err error)
- func (t *Manager) AddModule(module Module) (err error)
- func (t *Manager) DeleteCommand(command cli.Command)
- func (t *Manager) DeleteModule(module Module)
- func (t *Manager) GetCommands() (results []cli.Command)
- func (t *Manager) GetFlags() (results []cli.Flag)
- func (t *Manager) GetModules() (results Modules)
- func (t *Manager) MustAddBoolFlag(flag cli.BoolFlag) cli.BoolFlag
- func (t *Manager) MustAddIntFlag(flag cli.IntFlag) cli.IntFlag
- func (t *Manager) MustAddIntSliceFlag(flag cli.IntSliceFlag) cli.IntSliceFlag
- func (t *Manager) MustAddStringFlag(flag cli.StringFlag) cli.StringFlag
- func (t *Manager) MustAddStringSliceFlag(flag cli.StringSliceFlag) cli.StringSliceFlag
- func (t *Manager) Reset()
- func (t *Manager) SelectModules(moduleNames ...string) (results Modules, err error)
- type Module
- type ModuleFunc
- type Modules
Constants ¶
This section is empty.
Variables ¶
var ( ErrorModuleRegisted1 = errutil.NewFactory("Module already registed: %q") ErrorModuleNotFound1 = errutil.NewFactory("Module not found: %q") )
errors
var (
ErrorCommandRegisted1 = errutil.NewFactory("Command already registed: %q")
)
errors
var (
ErrorFlagRegisted1 = errutil.NewFactory("Flag already registed: %q")
)
errors
Functions ¶
func WrapAction ¶
WrapAction wrap action, handle return error with errutil.Trace()
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manage all registed cli module
func (*Manager) AddCommand ¶
AddCommand add command to manager
func (*Manager) DeleteCommand ¶
DeleteCommand delete command from manager
func (*Manager) DeleteModule ¶
DeleteModule delete module from manager
func (*Manager) GetCommands ¶
GetCommands return registed commands
func (*Manager) GetModules ¶
GetModules return registed modules, sorted by priority, module name
func (*Manager) MustAddBoolFlag ¶
MustAddBoolFlag add bool flag to manager, panic if error
func (*Manager) MustAddIntFlag ¶
MustAddIntFlag add int flag to manager, panic if error
func (*Manager) MustAddIntSliceFlag ¶
func (t *Manager) MustAddIntSliceFlag(flag cli.IntSliceFlag) cli.IntSliceFlag
MustAddIntSliceFlag add int slice flag to manager, panic if error
func (*Manager) MustAddStringFlag ¶
func (t *Manager) MustAddStringFlag(flag cli.StringFlag) cli.StringFlag
MustAddStringFlag add string flag to manager, panic if error
func (*Manager) MustAddStringSliceFlag ¶
func (t *Manager) MustAddStringSliceFlag(flag cli.StringSliceFlag) cli.StringSliceFlag
MustAddStringSliceFlag add string slice flag to manager, panic if error
type Module ¶
type Module struct { Name string ModuleFunc ModuleFunc CloseFunc ModuleFunc OptionalFunc BoolFunc Priority int8 // smaller value means high priority }
Module contain module detail
type ModuleFunc ¶
ModuleFunc module function for execute