25 Star 207 Fork 26

mix-go/mix

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
command.go 776 Bytes
一键复制 编辑 原始数据 按行查看 历史
package xcli
// Command
type Command struct {
// 命令名称
Name string
// 简短描述
Short string
// 详细描述
Long string
// 使用范例
// 子命令:"Usage: %s %s [ARG...]"
// 单命令:"Usage: %s [ARG...]"
UsageFormat string
// 选项
Options []*Option
// 执行
RunF func()
RunI RunI
// 是否单命令
Singleton bool
// 是否为默认命令
Default bool
// handlers
handlers []HandlerFunc
}
// AddOption
func (t *Command) AddOption(options ...*Option) *Command {
t.Options = append(t.Options, options...)
return t
}
// Use
func (t *Command) Use(h ...HandlerFunc) *Command {
t.handlers = append(t.handlers, h...)
return t
}
// RunI
type RunI interface {
Main()
}
// Option
type Option struct {
Names []string
Usage string
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mix-go/mix.git
git@gitee.com:mix-go/mix.git
mix-go
mix
mix
master

搜索帮助