Documentation ¶
Index ¶
- type Command
- func (c *Command) GetSubCommand(name string) *Command
- func (c *Command) Name() (name string)
- func (c *Command) Names() []string
- func (c *Command) NewSimpleSubCommand(name, summary string, aliasNames ...string) *Command
- func (c *Command) NewSubCommand(names []string, summary, mergeFlagPrefix string, ...) *Command
- func (c *Command) Options() *OptionSet
- func (c *Command) OutputHelp(w io.Writer)
- func (c *Command) Parse(specifiedArgs, configArgs []string) *ParseResult
- func (c *Command) ParseGroups(specifiedArgs, configArgs []string) (results []*ParseResult)
- func (c *Command) SubCommands() []*Command
- func (c *Command) Summary() string
- type Flag
- type Option
- func NewFlagOption(key, flag, envVar, summary string) Option
- func NewFlagValueOption(key, flag, envVar, defaultValue, summary string) Option
- func NewFlagValuesOption(key, flag, envVar string, defaultValues []string, summary string) Option
- func NewFlagsOption(key string, flags []string, envVar, summary string) Option
- func NewFlagsValueOption(key string, flags []string, envVar, defaultValue, summary string) Option
- func NewFlagsValuesOption(key string, flags []string, envVar string, defaultValues []string, ...) Option
- type OptionSet
- func (s *OptionSet) Add(opt Option) error
- func (s *OptionSet) AddFlag(key, flag, envVar, summary string) error
- func (s *OptionSet) AddFlagValue(key, flag, envVar, defaultValue, summary string) error
- func (s *OptionSet) AddFlagValues(key, flag, envVar string, defaultValues []string, summary string) error
- func (s *OptionSet) AddFlags(key string, flags []string, envVar, summary string) error
- func (s *OptionSet) AddFlagsValue(key string, flags []string, envVar, defaultValue, summary string) error
- func (s *OptionSet) AddFlagsValues(key string, flags []string, envVar string, defaultValues []string, ...) error
- func (s *OptionSet) GroupSeps() []string
- func (s *OptionSet) MergeFlagPrefix() string
- func (s *OptionSet) OutputHelp(w io.Writer)
- func (s *OptionSet) Parse(specifiedArgs, configArgs []string) *ParseResult
- func (s *OptionSet) ParseGroups(specifiedArgs, configArgs []string) []*ParseResult
- func (s *OptionSet) RestsSigns() []string
- func (s *OptionSet) UndefFlagPrefixes() []string
- type ParseResult
- func (r *ParseResult) GetAmbigus() []string
- func (r *ParseResult) GetBool(key string) (value bool, found bool)
- func (r *ParseResult) GetBools(key string) (values []bool, found bool)
- func (r *ParseResult) GetCommands() []string
- func (r *ParseResult) GetFloat64(key string) (value float64, found bool)
- func (r *ParseResult) GetFloat64s(key string) (values []float64, found bool)
- func (r *ParseResult) GetInt(key string) (value int, found bool)
- func (r *ParseResult) GetInt64(key string) (value int64, found bool)
- func (r *ParseResult) GetInt64s(key string) (values []int64, found bool)
- func (r *ParseResult) GetInts(key string) (values []int, found bool)
- func (r *ParseResult) GetRests() (rests []string)
- func (r *ParseResult) GetString(key string) (value string, found bool)
- func (r *ParseResult) GetStrings(key string) (values []string, found bool)
- func (r *ParseResult) GetUint64(key string) (value uint64, found bool)
- func (r *ParseResult) GetUint64s(key string) (values []uint64, found bool)
- func (r *ParseResult) GetUndefs() []string
- func (r *ParseResult) HasAmbigu() bool
- func (r *ParseResult) HasConfigKey(key string) bool
- func (r *ParseResult) HasConfigValue(key string) bool
- func (r *ParseResult) HasDefaultKey(key string) bool
- func (r *ParseResult) HasDefaultValue(key string) bool
- func (r *ParseResult) HasEnvKey(key string) bool
- func (r *ParseResult) HasEnvValue(key string) bool
- func (r *ParseResult) HasFlagKey(key string) bool
- func (r *ParseResult) HasFlagValue(key string) bool
- func (r *ParseResult) HasKey(key string) bool
- func (r *ParseResult) HasUndef() bool
- func (r *ParseResult) HasValue(key string) bool
- func (r *ParseResult) SetConfigOption(key, value string)
- func (r *ParseResult) SetConfigOptions(key string, values []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func NewSimpleCommand ¶
func (*Command) GetSubCommand ¶
func (*Command) NewSimpleSubCommand ¶
func (*Command) NewSubCommand ¶
func (*Command) OutputHelp ¶ added in v1.14.0
func (*Command) Parse ¶
func (c *Command) Parse(specifiedArgs, configArgs []string) *ParseResult
func (*Command) ParseGroups ¶
func (c *Command) ParseGroups(specifiedArgs, configArgs []string) (results []*ParseResult)
func (*Command) SubCommands ¶
type Flag ¶
type Flag struct { Name string // contains filtered or unexported fields }
func NewSimpleFlag ¶
func NewSimpleFlags ¶
type Option ¶
type Option struct { Key string Summary string Description string Flags []*Flag AcceptValue bool MultiValues bool OverridePrev bool Delimiters []rune UniqueValues bool EnvVars []string DefaultValues []string Hidden bool }
func NewFlagOption ¶ added in v1.8.0
func NewFlagValueOption ¶ added in v1.8.0
func NewFlagValuesOption ¶ added in v1.8.0
func NewFlagsOption ¶ added in v1.8.0
func NewFlagsValueOption ¶ added in v1.8.0
func NewFlagsValuesOption ¶ added in v1.8.0
func (*Option) OutputHelp ¶ added in v1.14.0
type OptionSet ¶
type OptionSet struct {
// contains filtered or unexported fields
}
func NewOptionSet ¶
func NewSimpleOptionSet ¶
func NewSimpleOptionSet() *OptionSet
func (*OptionSet) AddFlagValue ¶
func (*OptionSet) AddFlagValues ¶
func (*OptionSet) AddFlagsValue ¶
func (*OptionSet) AddFlagsValues ¶
func (*OptionSet) MergeFlagPrefix ¶ added in v1.1.0
func (*OptionSet) OutputHelp ¶ added in v1.14.0
func (*OptionSet) Parse ¶
func (s *OptionSet) Parse(specifiedArgs, configArgs []string) *ParseResult
func (*OptionSet) ParseGroups ¶
func (s *OptionSet) ParseGroups(specifiedArgs, configArgs []string) []*ParseResult
func (*OptionSet) RestsSigns ¶
func (*OptionSet) UndefFlagPrefixes ¶ added in v1.6.1
type ParseResult ¶
type ParseResult struct {
// contains filtered or unexported fields
}
func (*ParseResult) GetAmbigus ¶ added in v1.8.0
func (r *ParseResult) GetAmbigus() []string
func (*ParseResult) GetBools ¶
func (r *ParseResult) GetBools(key string) (values []bool, found bool)
func (*ParseResult) GetCommands ¶
func (r *ParseResult) GetCommands() []string
///////////////////////////// commands ////////////////////////////
func (*ParseResult) GetFloat64 ¶
func (r *ParseResult) GetFloat64(key string) (value float64, found bool)
func (*ParseResult) GetFloat64s ¶
func (r *ParseResult) GetFloat64s(key string) (values []float64, found bool)
func (*ParseResult) GetInt64s ¶
func (r *ParseResult) GetInt64s(key string) (values []int64, found bool)
func (*ParseResult) GetRests ¶
func (r *ParseResult) GetRests() (rests []string)
func (*ParseResult) GetString ¶
func (r *ParseResult) GetString(key string) (value string, found bool)
func (*ParseResult) GetStrings ¶
func (r *ParseResult) GetStrings(key string) (values []string, found bool)
///////////////////////////// get multi values ////////////////////////////
func (*ParseResult) GetUint64 ¶
func (r *ParseResult) GetUint64(key string) (value uint64, found bool)
func (*ParseResult) GetUint64s ¶
func (r *ParseResult) GetUint64s(key string) (values []uint64, found bool)
func (*ParseResult) GetUndefs ¶ added in v1.6.1
func (r *ParseResult) GetUndefs() []string
func (*ParseResult) HasAmbigu ¶ added in v1.8.0
func (r *ParseResult) HasAmbigu() bool
///////////////////////////// ambigus ////////////////////////////
func (*ParseResult) HasConfigKey ¶
func (r *ParseResult) HasConfigKey(key string) bool
func (*ParseResult) HasConfigValue ¶
func (r *ParseResult) HasConfigValue(key string) bool
func (*ParseResult) HasDefaultKey ¶
func (r *ParseResult) HasDefaultKey(key string) bool
func (*ParseResult) HasDefaultValue ¶
func (r *ParseResult) HasDefaultValue(key string) bool
func (*ParseResult) HasEnvKey ¶
func (r *ParseResult) HasEnvKey(key string) bool
func (*ParseResult) HasEnvValue ¶
func (r *ParseResult) HasEnvValue(key string) bool
func (*ParseResult) HasFlagKey ¶
func (r *ParseResult) HasFlagKey(key string) bool
func (*ParseResult) HasFlagValue ¶
func (r *ParseResult) HasFlagValue(key string) bool
func (*ParseResult) HasKey ¶
func (r *ParseResult) HasKey(key string) bool
func (*ParseResult) HasUndef ¶ added in v1.6.1
func (r *ParseResult) HasUndef() bool
///////////////////////////// undefs ////////////////////////////
func (*ParseResult) HasValue ¶
func (r *ParseResult) HasValue(key string) bool
func (*ParseResult) SetConfigOption ¶ added in v1.14.0
func (r *ParseResult) SetConfigOption(key, value string)
///////////////////////////// set configOptions ////////////////////////////
func (*ParseResult) SetConfigOptions ¶ added in v1.14.0
func (r *ParseResult) SetConfigOptions(key string, values []string)
Click to show internal directories.
Click to hide internal directories.