Documentation
¶
Index ¶
- func CheckInputType(value string, inputType InputType) bool
- func GetBool(value string) bool
- func GetFloat(value string) float64
- func GetInt(value string) int
- func RegisterInputType(typeName InputType, checker *regexp.Regexp)
- type Context
- type FormatBuilder
- func (f *FormatBuilder) Action(handler Handler) *FormatBuilder
- func (f *FormatBuilder) Alias(pattern string, transform func(*Context) *Context) *FormatBuilder
- func (f *FormatBuilder) Argument(name string, inputType InputType, required bool, help string) *FormatBuilder
- func (f *FormatBuilder) Build() (func(), error)
- func (f *FormatBuilder) Description(desc string) *FormatBuilder
- func (f *FormatBuilder) Option(name string, shortName string, inputType InputType, required bool, ...) *FormatBuilder
- func (f *FormatBuilder) SubCommand(name string) *FormatBuilder
- type Handler
- type InputType
- type ParsedArguments
- type ParsedOptions
- type Registry
- type Schema
- type SchemaArgument
- type SchemaOption
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckInputType ¶ added in v0.1.0
func RegisterInputType ¶ added in v0.1.0
Types ¶
type Context ¶
type Context struct {
botc.MessageContext
Commands []string
Arguments []string
KvArgs map[string]string
Options map[string]string
// contains filtered or unexported fields
}
func NewCommandContext ¶
func NewCommandContext(msg botc.MessageContext, text string) *Context
type FormatBuilder ¶
type FormatBuilder struct {
// contains filtered or unexported fields
}
func NewCommandFormatBuilder ¶
func NewCommandFormatBuilder(name string, system *System) *FormatBuilder
func (*FormatBuilder) Action ¶
func (f *FormatBuilder) Action(handler Handler) *FormatBuilder
func (*FormatBuilder) Alias ¶
func (f *FormatBuilder) Alias(pattern string, transform func(*Context) *Context) *FormatBuilder
func (*FormatBuilder) Argument ¶ added in v0.1.0
func (f *FormatBuilder) Argument(name string, inputType InputType, required bool, help string) *FormatBuilder
func (*FormatBuilder) Build ¶
func (f *FormatBuilder) Build() (func(), error)
func (*FormatBuilder) Description ¶ added in v0.1.0
func (f *FormatBuilder) Description(desc string) *FormatBuilder
func (*FormatBuilder) Option ¶
func (f *FormatBuilder) Option(name string, shortName string, inputType InputType, required bool, Default string, help string) *FormatBuilder
func (*FormatBuilder) SubCommand ¶
func (f *FormatBuilder) SubCommand(name string) *FormatBuilder
type ParsedArguments ¶ added in v0.1.0
type ParsedArguments = []string
type ParsedOptions ¶ added in v0.1.0
type Registry ¶
type Registry struct {
Name string
Schema Schema
Handler Handler
Aliases []alias
SubRegistries []Registry
}
func (*Registry) CheckAlias ¶
type Schema ¶ added in v0.1.0
type Schema struct {
Name string
Description string
Options []SchemaOption
Arguments []SchemaArgument
SubCommandSchemas []Schema
}
func (*Schema) AddArgument ¶ added in v0.1.0
func (*Schema) AddSubCommandSchema ¶ added in v0.1.0
type SchemaArgument ¶ added in v0.1.0
type SchemaOption ¶ added in v0.1.0
type System ¶
type System struct {
// contains filtered or unexported fields
}
func NewCommandSystem ¶
func NewCommandSystem() *System
func (*System) CheckAliases ¶ added in v0.1.0
CheckAliases 遍历所有已注册命令检查别名匹配
func (*System) GetSchemas ¶ added in v0.1.0
GetSchemas 返回所有已注册的顶级命令 Schema
Click to show internal directories.
Click to hide internal directories.