Documentation ¶
Index ¶
- func DisableMousetrap()
- type ArgMarshaler
- type Argument
- type Command
- func (c *Command) ActiveFlagNames() []string
- func (c *Command) ActiveFlags() []*Flag
- func (c *Command) AddChildren(children ...*Command)
- func (c *Command) AddLegacyChildren(children ...*cobra.Command)
- func (c *Command) Arguments() []*Argument
- func (c *Command) AvailableChildren() []*Command
- func (c *Command) Children() []*Command
- func (c *Command) DeprioritizeInHelpListing()
- func (c *Command) Description() string
- func (c *Command) Examples() []string
- func (c *Command) Execute(args []string) error
- func (c *Command) ExecuteFunc() ExecuteFunc
- func (c *Command) FindChild(args []string) (*Command, error)
- func (c *Command) Flags() []*Flag
- func (c *Command) GenBashCompletions() (string, error)
- func (c *Command) GenFishCompletions() (string, error)
- func (c *Command) GenPowerShellCompletion() (string, error)
- func (c *Command) GenZshCompletion() (string, error)
- func (c *Command) Group() CommandGroup
- func (c *Command) Help() string
- func (c *Command) Hidden() bool
- func (c *Command) InheritedFlagUsages() string
- func (c *Command) JoinedCommandNames() string
- func (c *Command) JoinedSubCommandNames() string
- func (c *Command) LocalFlagUsages() string
- func (c *Command) Name() string
- func (c *Command) NamePadding() int
- func (c *Command) NameRecursive() string
- func (c *Command) OnExecStart(handler ExecEventHandler)
- func (c *Command) OnExecStop(handler ExecEventHandler)
- func (c *Command) Parent() *Command
- func (c *Command) SetAliases(aliases ...string)
- func (c *Command) SetDeferAnalytics(value bool)
- func (c *Command) SetDescription(description string)
- func (c *Command) SetDisableFlagParsing(b bool)
- func (c *Command) SetExamples(examples ...string) *Command
- func (c *Command) SetGroup(group CommandGroup) *Command
- func (c *Command) SetHasVariableArguments() *Command
- func (c *Command) SetHidden(value bool)
- func (c *Command) SetSkipChecks(value bool)
- func (c *Command) SetSupportsStructuredOutput() *Command
- func (c *Command) SetUnstable(unstable bool) *Command
- func (c *Command) ShortDescription() string
- func (c *Command) SkipChecks() bool
- func (c *Command) SortBefore(c2 *Command) bool
- func (c *Command) Title() string
- func (c *Command) TopParent() *Command
- func (c *Command) Unstable() bool
- func (cmd *Command) Usage() error
- func (c *Command) UsageText() string
- func (c *Command) Use() string
- type CommandGroup
- type ErrNoChildren
- type ExecEventHandler
- type ExecuteFunc
- type Flag
- type FlagMarshaler
- type IntValue
- type NameVersionValue
- type NullBool
- type NullInt
- type NullString
- type PackageValue
- type PackageValueNSRequired
- type PackageValueNoVersion
- type PackagesValue
- type PackagesValueNoVersion
- type TimeValue
- type UserValue
- type UsersValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableMousetrap ¶
func DisableMousetrap()
Types ¶
type ArgMarshaler ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func NewCommand(name, title, description string, prime primer, flags []*Flag, args []*Argument, execute ExecuteFunc) *Command
func (*Command) ActiveFlagNames ¶
func (*Command) ActiveFlags ¶
func (*Command) AddChildren ¶
func (*Command) AddLegacyChildren ¶
func (*Command) AvailableChildren ¶
func (*Command) DeprioritizeInHelpListing ¶
func (c *Command) DeprioritizeInHelpListing()
func (*Command) Description ¶
func (*Command) ExecuteFunc ¶
func (c *Command) ExecuteFunc() ExecuteFunc
func (*Command) GenBashCompletions ¶
func (*Command) GenFishCompletions ¶
func (*Command) GenPowerShellCompletion ¶
func (*Command) GenZshCompletion ¶
func (*Command) Group ¶
func (c *Command) Group() CommandGroup
func (*Command) InheritedFlagUsages ¶
InheritedFlagUsages is a substitute for c.cobra.InheritedFlags().FlagUsages() to replace Cobra's intuited flag value placeholders with "<value>".
func (*Command) JoinedCommandNames ¶
func (*Command) JoinedSubCommandNames ¶
func (*Command) LocalFlagUsages ¶
LocalFlagUsages is a substitute for c.cobra.LocalFlags().FlagUsages() to replace Cobra's intuited flag value placeholders with "<value>".
func (*Command) NamePadding ¶
func (*Command) NameRecursive ¶
func (*Command) OnExecStart ¶
func (c *Command) OnExecStart(handler ExecEventHandler)
func (*Command) OnExecStop ¶
func (c *Command) OnExecStop(handler ExecEventHandler)
func (*Command) SetAliases ¶
func (*Command) SetDeferAnalytics ¶
func (*Command) SetDescription ¶
func (*Command) SetDisableFlagParsing ¶
func (*Command) SetExamples ¶
func (*Command) SetGroup ¶
func (c *Command) SetGroup(group CommandGroup) *Command
SetGroup sets the group this command belongs to. This defaults to empty, meaning the command is ungrouped. Realistically only top level commands really need a group.
func (*Command) SetHasVariableArguments ¶
SetHasVariableArguments allows a captain Command to accept a variable number of command line arguments. By default, captain has Cobra restrict the command line arguments accepted to those given in the []*Argument list to NewCommand().
func (*Command) SetSkipChecks ¶
func (*Command) SetSupportsStructuredOutput ¶
func (*Command) SetUnstable ¶
SetUnstable denotes if the command as a beta feature. This will remove the command from state help, disable the commmand for those who haven't opted in to beta features, and add a warning banner for those who have.
func (*Command) ShortDescription ¶
func (*Command) SkipChecks ¶
func (*Command) SortBefore ¶
type CommandGroup ¶
type CommandGroup struct {
// contains filtered or unexported fields
}
func NewCommandGroup ¶
func NewCommandGroup(name string, priority int) CommandGroup
func (CommandGroup) SortBefore ¶
func (c CommandGroup) SortBefore(c2 CommandGroup) bool
func (CommandGroup) String ¶
func (c CommandGroup) String() string
type ErrNoChildren ¶
type ErrNoChildren struct{ *locale.LocalizedError }
type ExecEventHandler ¶
type ExecuteFunc ¶
type Flag ¶
type Flag struct { Name string Shorthand string Description string Persist bool Value interface{} Hidden bool OnUse func() }
Flag is used to define flags in our Command struct
type FlagMarshaler ¶
type NameVersionValue ¶
type NameVersionValue struct {
// contains filtered or unexported fields
}
NameVersionValue represents a flag that supports both a name and a version, the following formats are supported: - name - name@version
func (*NameVersionValue) Name ¶
func (nv *NameVersionValue) Name() string
func (*NameVersionValue) Set ¶
func (nv *NameVersionValue) Set(arg string) error
func (*NameVersionValue) String ¶
func (nv *NameVersionValue) String() string
func (*NameVersionValue) Type ¶
func (nv *NameVersionValue) Type() string
func (*NameVersionValue) Version ¶
func (nv *NameVersionValue) Version() string
type NullString ¶
type NullString struct {
// contains filtered or unexported fields
}
func (*NullString) AsPtrTo ¶
func (s *NullString) AsPtrTo() *string
func (*NullString) IsSet ¶
func (s *NullString) IsSet() bool
func (*NullString) Set ¶
func (s *NullString) Set(v string) error
func (*NullString) String ¶
func (s *NullString) String() string
func (*NullString) Type ¶
func (s *NullString) Type() string
type PackageValue ¶
type PackageValue struct { Namespace string `json:"namespace"` Name string `json:"name"` Version string `json:"version,omitempty"` }
PackageValue represents a flag that supports specifying a package in the following formats: - <name> - <namespace>/<name> - <namespace>/<name>@<version>
func (*PackageValue) Set ¶
func (p *PackageValue) Set(s string) error
func (*PackageValue) String ¶
func (p *PackageValue) String() string
func (*PackageValue) Type ¶
func (p *PackageValue) Type() string
type PackageValueNSRequired ¶
type PackageValueNSRequired struct {
PackageValue
}
PackageValueNSRequired is identical to PackageValue except that specifying a namespace is required.
func (*PackageValueNSRequired) Set ¶
func (p *PackageValueNSRequired) Set(s string) error
func (*PackageValueNSRequired) Type ¶
func (p *PackageValueNSRequired) Type() string
type PackageValueNoVersion ¶
type PackageValueNoVersion struct {
PackageValue
}
PackageValueNoVersion is identical to PackageValue except that it does not support a version.
func (*PackageValueNoVersion) Set ¶
func (p *PackageValueNoVersion) Set(s string) error
func (*PackageValueNoVersion) Type ¶
func (p *PackageValueNoVersion) Type() string
type PackagesValue ¶
type PackagesValue []*PackageValue
PackagesValue is used to represent multiple PackageValue, this is used when a flag can be passed multiple times.
func (*PackagesValue) Add ¶
func (p *PackagesValue) Add(s string) (*PackageValue, error)
func (*PackagesValue) Set ¶
func (p *PackagesValue) Set(s string) error
func (*PackagesValue) String ¶
func (p *PackagesValue) String() string
func (*PackagesValue) Type ¶
func (p *PackagesValue) Type() string
type PackagesValueNoVersion ¶
type PackagesValueNoVersion []PackageValueNoVersion
func (*PackagesValueNoVersion) Set ¶
func (p *PackagesValueNoVersion) Set(s string) error
func (*PackagesValueNoVersion) String ¶
func (p *PackagesValueNoVersion) String() string
func (*PackagesValueNoVersion) Type ¶
func (p *PackagesValueNoVersion) Type() string
type UserValue ¶
UserValue represents a flag that supports both a name and an email address, the following formats are supported: - name <email> - email Emails are detected simply by containing a @ symbol.
type UsersValue ¶
type UsersValue []UserValue
UsersValue is used to represent multiple UserValue, this is used when a flag can be passed multiple times.
func (*UsersValue) Set ¶
func (u *UsersValue) Set(s string) error
func (*UsersValue) String ¶
func (u *UsersValue) String() string
func (*UsersValue) Type ¶
func (u *UsersValue) Type() string