{"modulePath":"github.com/WebGameLinux/cli","version":"v0.0.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package core\n\n## Constants\n\n```go\nconst CommandKey = \"Command\"\n```\n\n## Functions\n\n```go\nfunc CommanderRegisterFn(commander Commander, app *CmdApp)\n```\n默认commander 自动注册 到 cli 应用的方法\n\n```go\nfunc CreateCommandByMap(data map[string]interface{}) *cli.Command\n```\n\n```go\nfunc NewCommand() *cli.Command\n```\n\n## Types\n\n```go\ntype AutoInit interface {\n\tInit()\n}\n```\n自动初始化内部属性 和 方法\n\n```go\ntype BaseCommander struct {\n\tCommand *cli.Command\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (commander *BaseCommander) Argument() CommanderArgument\n```\n\n```go\nfunc (commander *BaseCommander) Arguments() (flags []cli.Flag)\n```\n\n```go\nfunc (commander *BaseCommander) Boot()\n```\n自定义引导\n\n```go\nfunc (commander *BaseCommander) GetCommand() *cli.Command\n```\n获取 command 对象\n\n```go\nfunc (commander *BaseCommander) Handle(ctx *cli.Context) error\n```\n请执行实现 处理逻辑\n\n```go\nfunc (commander *BaseCommander) Init()\n```\n初始化\n\n```go\nfunc (commander *BaseCommander) InitCommand() *BaseCommander\n```\n构造新command\n\n```go\nfunc (commander *BaseCommander) Register(app *CmdApp)\n```\n必须自行实现注册 覆盖 BaseCommander\n\n```go\nfunc (commander *BaseCommander) SetProperties(properties map[string]interface{})\n```\n通过 map 设置 command 相关参数\n\n```go\ntype BootAble interface {\n\tBoot()\n}\n```\n自主 加载相关信息\n\n```go\ntype CmdApp struct {\n\tcli.App\n\t// contains filtered or unexported fields\n}\n```\n命令行应用\n\n```go\nfunc NewCmdApp() *CmdApp\n```\n\n```go\nfunc (cmd *CmdApp) AppendCommand(commander Commander, index ...int)\n```\n追加命令\n\n```go\nfunc (cmd *CmdApp) Init()\n```\n初始化\n\n```go\nfunc (cmd *CmdApp) InsertCommand(commander Commander) *CmdApp\n```\n添加command\n\n```go\nfunc (cmd *CmdApp) IsLoaded(key string) bool\n```\n是否已加载\n\n```go\nfunc (cmd *CmdApp) IsLocked() bool\n```\n是否已经初始化 , 加载过\n\n```go\nfunc (cmd *CmdApp) Len() int\n```\n命令数量\n\n```go\nfunc (cmd *CmdApp) Less(i, j int) bool\n```\n\n```go\nfunc (cmd *CmdApp) LoadCommands(commanders ...Commander) *CmdApp\n```\n加载\n\n```go\nfunc (cmd *CmdApp) Run() error\n```\n运行\n\n```go\nfunc (cmd *CmdApp) SetProperties(properties map[string]interface{})\n```\n设置 应用属性\n\n```go\nfunc (cmd *CmdApp) Swap(i, j int)\n```\n\n```go\ntype CommandAutoRegister interface {\n\tRegister(app *CmdApp)\n}\n```\n命令自动挂载\n\n```go\ntype Commander interface {\n\tAutoInit\n\tBootAble\n\tCommandAutoRegister\n\tGetCommand() *cli.Command\n\tArgument() CommanderArgument\n}\n```\n参数命令行\n\n```go\nfunc NewCommander(data map[string]interface{}) Commander\n```\n\n```go\ntype CommanderArgument interface {\n\tArguments() []cli.Flag\n\tSetArguments([]cli.Flag)\n\tAddArgument(cli.Flag)\n}\n```\n命令行参数器\n\n```go\nfunc NewCommanderArgument(cmd *cli.Command) CommanderArgument\n```\n\n```go\ntype CommanderArguments struct {\n\tCommand *cli.Command\n}\n```\n\n```go\nfunc (args *CommanderArguments) AddArgument(arg cli.Flag)\n```\n\n```go\nfunc (args *CommanderArguments) Arguments() []cli.Flag\n```\n\n```go\nfunc (args *CommanderArguments) SetArguments(lists []cli.Flag)\n```\n\n```go\ntype CommanderHandler interface {\n\tHandle(*cli.Context) error\n}\n```\n命令处理逻辑函数接口\n\n```go\ntype MapPropertiesSetter interface {\n\tSetProperties(map[string]interface{})\n}\n```\n通用属性设置\n\n```go\ntype Runner interface {\n\tRun() error\n}\n```\n\n","path":"github.com/WebGameLinux/cli/core","name":"core","synopsis":"","isRedistributable":true}
