Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseCommand ¶
BaseCommand 基础命令结构体,提供通用实现
func (*BaseCommand) GetCobraCmd ¶
func (b *BaseCommand) GetCobraCmd() *cobra.Command
GetCobraCmd 获取cobra命令
type Command ¶
type Command interface {
// Init 初始化命令,设置标志等
Init()
// GetCobraCmd 获取cobra命令
GetCobraCmd() *cobra.Command
}
Command 命令接口,所有命令都需要实现此接口
type CommandRegistry ¶
type CommandRegistry struct {
// contains filtered or unexported fields
}
CommandRegistry 命令注册表,保存所有注册的命令
func NewCommandRegistry ¶
func NewCommandRegistry(rootCmd *cobra.Command) *CommandRegistry
NewCommandRegistry 创建一个命令注册表
func (*CommandRegistry) RegisterCommands ¶
func (r *CommandRegistry) RegisterCommands()
RegisterCommands 注册所有命令
Click to show internal directories.
Click to hide internal directories.