Documentation ¶
Index ¶
Constants ¶
View Source
const ( StringFlag = iota IntFlag Int64Flag Float64Flag BoolFlag )
Supported flags.
Variables ¶
This section is empty.
Functions ¶
func AddFlag ¶
func AddFlag(cmd *Command, config FlagConfig)
AddFlag attaches a flag of the given type with the specified configuration.
Types ¶
type Command ¶
Command wraps a base cobra command to add some custom functionality.
func (*Command) AddCommand ¶
AddCommand adds child commands and also to cobra.
func (*Command) GetSubCommands ¶
GetSubCommands returns the command sub commands.
type Config ¶
type Config struct { DisableAutoGenTag bool DisableSuggentions bool Hidden bool SuggestMinDistance int LongDesc string Deprecated string Example string Namespace string ShortDesc string Version string Aliases []string SuggestFor []string ValidArgs []string Execute func(cmd *cobra.Command, args []string) PersistentPostHook func(cmd *cobra.Command, args []string) PersistentPreHook func(cmd *cobra.Command, args []string) PostHook func(cmd *cobra.Command, args []string) PreHook func(cmd *cobra.Command, args []string) ExecuteErr func(cmd *cobra.Command, args []string) error PersistentPostHookErr func(cmd *cobra.Command, args []string) error PersistentPreHookErr func(cmd *cobra.Command, args []string) error PostHookErr func(cmd *cobra.Command, args []string) error PreHookErr func(cmd *cobra.Command, args []string) error ValidArgsFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) }
Config contains a command configuration.
type FlagBindOptions ¶
type FlagBindOptions struct { Bound bool BindInt *int BindInt64 *int64 BindString *string BindBool *bool BindFloat64 *float64 }
FlagBindOptions exposes the parameters used to bind a flag to a passed pointer.
type FlagConfig ¶
type FlagConfig struct { FlagType int Name string Shorthand string Usage string Default interface{} Required bool Persistent bool Binding FlagBindOptions }
FlagConfig defines the configuration of a flag.
Click to show internal directories.
Click to hide internal directories.