Documentation ¶
Index ¶
- func BindCmdFlags(cmd *cobra.Command) error
- func GetBool(key string) bool
- func GetDuration(key string) time.Duration
- func GetInt(key string) int
- func GetInt32(key string) int32
- func GetInt64(key string) int64
- func GetIntSlice(key string) []int
- func GetString(key string) string
- func GetStringSlice(key string) []string
- func GetTime(key string) time.Time
- func GetUint(key string) uint
- func GetUint32(key string) uint32
- func GetUint64(key string) uint64
- func Init(configFileName string, configSearchPaths ...string) error
- func MustInit(configFileName string, configSearchPaths ...string)
- func Set(key string, val interface{})
- func SetCmdFlags(cmd *cobra.Command, opts ...FlagOption)
- func SetCmdPersistentFlags(cmd *cobra.Command, opts ...FlagOption)
- func SetEnvPrefix(prefix string)
- func SetFlags(cmd *cobra.Command, opts ...FlagOption)
- func SetPersistentFlags(cmd *cobra.Command, opts ...FlagOption)
- type FlagOption
- func BoolFlag(name string, value bool, usage string) FlagOption
- func DurationFlag(name string, value time.Duration, usage string) FlagOption
- func Int32Flag(name string, value int32, usage string) FlagOption
- func Int64Flag(name string, value int64, usage string) FlagOption
- func Int64SliceFlag(name string, value []int64, usage string) FlagOption
- func IntFlag(name string, value int, usage string) FlagOption
- func StringFlag(name, value, usage string) FlagOption
- func StringSliceFlag(name string, value []string, usage string) FlagOption
- func UInt32Flag(name string, value uint32, usage string) FlagOption
- func UInt64Flag(name string, value uint64, usage string) FlagOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindCmdFlags ¶
BindCmdFlags binds a full flag set to the configuration, using each flag's long name as the config key.
func GetDuration ¶
func GetIntSlice ¶
func GetStringSlice ¶
func Set ¶
func Set(key string, val interface{})
Set sets the value for the key in the override register. Set is case-insensitive for a key. Will be used instead of values obtained via flags, config file, ENV, default, or key/value store.
func SetCmdFlags ¶
func SetCmdFlags(cmd *cobra.Command, opts ...FlagOption)
SetCmdFlags sets the flags defined by FlagOption to the command 'cmd'.
func SetCmdPersistentFlags ¶
func SetCmdPersistentFlags(cmd *cobra.Command, opts ...FlagOption)
SetCmdPersistentFlags sets the persistent flags defined by FlagOption to the command 'cmd'.
func SetEnvPrefix ¶
func SetEnvPrefix(prefix string)
SetEnvPrefix defines a prefix that ENVIRONMENT variables will use. // E.g. if your prefix is "spf", the env registry will look for env // variables that start with "SPF_".
func SetFlags ¶
func SetFlags(cmd *cobra.Command, opts ...FlagOption)
func SetPersistentFlags ¶
func SetPersistentFlags(cmd *cobra.Command, opts ...FlagOption)
Types ¶
type FlagOption ¶
func DurationFlag ¶
func DurationFlag(name string, value time.Duration, usage string) FlagOption
func Int64SliceFlag ¶
func Int64SliceFlag(name string, value []int64, usage string) FlagOption
func StringFlag ¶
func StringFlag(name, value, usage string) FlagOption
func StringSliceFlag ¶
func StringSliceFlag(name string, value []string, usage string) FlagOption
func UInt32Flag ¶
func UInt32Flag(name string, value uint32, usage string) FlagOption
func UInt64Flag ¶
func UInt64Flag(name string, value uint64, usage string) FlagOption
Click to show internal directories.
Click to hide internal directories.