package commandimport ()typeCommandstruct { Name string`yaml:"name" json:"name" jsonschema_description:"Name of the command"` Aliases []string`yaml:"aliases,omitempty" json:"aliases,omitempty" jsonschema_description:"Aliases of the command"` Description string`yaml:"description,omitempty" json:"description,omitempty" jsonschema_description:"Description of the command"` Group string`yaml:"group,omitempty" json:"group,omitempty" jsonschema_description:"Group of the command"` Hidden bool`yaml:"hidden,omitempty" json:"hidden,omitempty" jsonschema_description:"Hidden state of the command"` Parsing Parsing`yaml:"parsing,omitempty" json:"parsing,omitempty" jsonschema_description:"Flag parsing mode of the command" jsonschema:"enum=interspersed,enum=non-interspersed,enum=disabled"` Flags FlagSet`yaml:"flags,omitempty" json:"flags,omitempty" jsonschema_description:"Flags of the command with their description"` PersistentFlags FlagSet`yaml:"persistentflags,omitempty" json:"persistentflags,omitempty" jsonschema_description:"Persistent flags of the command with their description"` ExclusiveFlags [][]string`yaml:"exclusiveflags,omitempty" json:"exclusiveflags,omitempty" jsonschema_description:"Flags that are mutually exclusive"` Run Run`yaml:"run,omitempty" json:"run,omitempty" jsonschema:"oneof_type=string;array" jsonschema_description:"Command or script to execute in runnable mode"` Completion struct { Flag map[string][]string`yaml:"flag,omitempty" json:"flag,omitempty" jsonschema_description:"Flag completion"` Positional [][]string`yaml:"positional,omitempty" json:"positional,omitempty" jsonschema_description:"Positional completion"` PositionalAny []string`yaml:"positionalany,omitempty" json:"positionalany,omitempty" jsonschema_description:"Positional completion for every other position"` Dash [][]string`yaml:"dash,omitempty" json:"dash,omitempty" jsonschema_description:"Dash completion"` DashAny []string`yaml:"dashany,omitempty" json:"dashany,omitempty" jsonschema_description:"Dash completion of every other position"` } `yaml:"completion,omitempty" json:"completion,omitzero" jsonschema_description:"Completion definition"` Commands []Command`yaml:"commands,omitempty" json:"commands,omitempty" jsonschema_description:"Subcommands of the command"` Documentation struct { Command string`yaml:"command,omitempty" json:"command,omitempty" jsonschema_description:"Documentation of the command"` Flag map[string]string`yaml:"flag,omitempty" json:"flag,omitempty" jsonschema_description:"Documentation of flags"` Positional []string`yaml:"positional,omitempty" json:"positional,omitempty" jsonschema_description:"Documentation of positional arguments"` PositionalAny string`yaml:"positionalany,omitempty" json:"positionalany,omitempty" jsonschema_description:"Documentation of other positional arguments"` Dash []string`yaml:"dash,omitempty" json:"dash,omitempty" jsonschema_description:"Documentation of dash arguments"` DashAny string`yaml:"dashany,omitempty" json:"dashany,omitempty" jsonschema_description:"Documentation of other dash arguments"` } `yaml:"documentation,omitempty" json:"documentation,omitzero" jsonschema_description:"Documentation"` Examples map[string]string`yaml:"examples,omitempty" json:"examples,omitempty" jsonschema_description:"Examples"`}func ( *Command) ( Flag) {switch {case .Persistent:if .PersistentFlags == nil { .PersistentFlags = make(FlagSet) } .PersistentFlags[.format()] = default:if .Flags == nil { .Flags = make(FlagSet) } .Flags[.format()] = }}func ( *Command) ( []string) (*Command, error) {iflen() == 0 {return , nil }for , := range .Commands {ifstrings.Split(.Name, " ")[0] == [0] {return .([1:]) } }returnnil, errors.New("not found")}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.