Documentation
¶
Index ¶
- Constants
- func CommanderRegisterFn(commander Commander, app *CmdApp)
- func CreateCommandByMap(data map[string]interface{}) *cli.Command
- func NewCommand() *cli.Command
- type AutoInit
- type BaseCommander
- func (commander *BaseCommander) Argument() CommanderArgument
- func (commander *BaseCommander) Arguments() (flags []cli.Flag)
- func (commander *BaseCommander) Boot()
- func (commander *BaseCommander) GetCommand() *cli.Command
- func (commander *BaseCommander) Handle(ctx *cli.Context) error
- func (commander *BaseCommander) Init()
- func (commander *BaseCommander) InitCommand() *BaseCommander
- func (commander *BaseCommander) Register(app *CmdApp)
- func (commander *BaseCommander) SetProperties(properties map[string]interface{})
- type BootAble
- type CmdApp
- func (cmd *CmdApp) AppendCommand(commander Commander, index ...int)
- func (cmd *CmdApp) Init()
- func (cmd *CmdApp) InsertCommand(commander Commander) *CmdApp
- func (cmd *CmdApp) IsLoaded(key string) bool
- func (cmd *CmdApp) IsLocked() bool
- func (cmd *CmdApp) Len() int
- func (cmd *CmdApp) Less(i, j int) bool
- func (cmd *CmdApp) LoadCommands(commanders ...Commander) *CmdApp
- func (cmd *CmdApp) Run() error
- func (cmd *CmdApp) SetProperties(properties map[string]interface{})
- func (cmd *CmdApp) Swap(i, j int)
- type CommandAutoRegister
- type Commander
- type CommanderArgument
- type CommanderArguments
- type CommanderHandler
- type MapPropertiesSetter
- type Runner
Constants ¶
View Source
const CommandKey = "Command"
Variables ¶
This section is empty.
Functions ¶
func CommanderRegisterFn ¶
默认commander 自动注册 到 cli 应用的方法
func CreateCommandByMap ¶
func NewCommand ¶
Types ¶
type BaseCommander ¶
func (*BaseCommander) Argument ¶
func (commander *BaseCommander) Argument() CommanderArgument
func (*BaseCommander) Arguments ¶
func (commander *BaseCommander) Arguments() (flags []cli.Flag)
func (*BaseCommander) GetCommand ¶
func (commander *BaseCommander) GetCommand() *cli.Command
获取 command 对象
func (*BaseCommander) Handle ¶
func (commander *BaseCommander) Handle(ctx *cli.Context) error
请执行实现 处理逻辑
func (*BaseCommander) InitCommand ¶
func (commander *BaseCommander) InitCommand() *BaseCommander
构造新command
func (*BaseCommander) Register ¶
func (commander *BaseCommander) Register(app *CmdApp)
必须自行实现注册 覆盖 BaseCommander
func (*BaseCommander) SetProperties ¶
func (commander *BaseCommander) SetProperties(properties map[string]interface{})
通过 map 设置 command 相关参数
type CmdApp ¶
命令行应用
func (*CmdApp) AppendCommand ¶
追加命令
func (*CmdApp) InsertCommand ¶
添加command
func (*CmdApp) SetProperties ¶
设置 应用属性
type Commander ¶
type Commander interface {
AutoInit
BootAble
CommandAutoRegister
GetCommand() *cli.Command
Argument() CommanderArgument
}
参数命令行
func NewCommander ¶
type CommanderArgument ¶
type CommanderArgument interface {
Arguments() []cli.Flag
SetArguments([]cli.Flag)
AddArgument(cli.Flag)
}
命令行参数器
func NewCommanderArgument ¶
func NewCommanderArgument(cmd *cli.Command) CommanderArgument
type CommanderArguments ¶
func (*CommanderArguments) AddArgument ¶
func (args *CommanderArguments) AddArgument(arg cli.Flag)
func (*CommanderArguments) Arguments ¶
func (args *CommanderArguments) Arguments() []cli.Flag
func (*CommanderArguments) SetArguments ¶
func (args *CommanderArguments) SetArguments(lists []cli.Flag)
type MapPropertiesSetter ¶
type MapPropertiesSetter interface {
SetProperties(map[string]interface{})
}
通用属性设置
Click to show internal directories.
Click to hide internal directories.