Documentation ¶
Index ¶
- func AllSettings() map[string]interface{}
- 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 GetInt32Slice(key string) []int32
- func GetInt64(key string) int64
- func GetInt64Slice(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 ReadFile(configFileName string, configSearchPaths ...string) error
- 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 Config
- func (c *Config) AllSettings() map[string]interface{}
- func (c *Config) BindCmdFlags(cmd *cobra.Command) error
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetDuration(key string) time.Duration
- func (c *Config) GetInt(key string) int
- func (c *Config) GetInt32(key string) int32
- func (c *Config) GetInt32Slice(key string) []int32
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetInt64Slice(key string) []int64
- func (c *Config) GetIntSlice(key string) []int
- func (c *Config) GetString(key string) string
- func (c *Config) GetStringSlice(key string) []string
- func (c *Config) GetTime(key string) time.Time
- func (c *Config) GetUint(key string) uint
- func (c *Config) GetUint32(key string) uint32
- func (c *Config) GetUint64(key string) uint64
- func (c *Config) ReadFile(configFileName string, configSearchPaths ...string) error
- func (c *Config) Set(key string, val interface{})
- func (c *Config) SetEnvPrefix(prefix string)
- 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 AllSettings ¶ added in v0.12.54
func AllSettings() map[string]interface{}
func BindCmdFlags ¶
func GetDuration ¶
func GetInt32Slice ¶ added in v0.6.20
func GetInt64Slice ¶ added in v0.6.20
func GetIntSlice ¶
func GetStringSlice ¶
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)
func SetFlags ¶
func SetFlags(cmd *cobra.Command, opts ...FlagOption)
func SetPersistentFlags ¶
func SetPersistentFlags(cmd *cobra.Command, opts ...FlagOption)
Types ¶
type Config ¶ added in v0.14.3
type Config struct {
// contains filtered or unexported fields
}
func (*Config) AllSettings ¶ added in v0.14.3
func (*Config) BindCmdFlags ¶ added in v0.14.3
BindCmdFlags binds a full flag set to the configuration, using each flag's long name as the config key.
func (*Config) GetDuration ¶ added in v0.14.3
func (*Config) GetInt32Slice ¶ added in v0.14.3
func (*Config) GetInt64Slice ¶ added in v0.14.3
func (*Config) GetIntSlice ¶ added in v0.14.3
func (*Config) GetStringSlice ¶ added in v0.14.3
func (*Config) Set ¶ added in v0.14.3
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 (*Config) SetEnvPrefix ¶ added in v0.14.3
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_".
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 ¶ added in v0.3.2
func Uint32Flag(name string, value uint32, usage string) FlagOption
func Uint64Flag ¶ added in v0.3.2
func Uint64Flag(name string, value uint64, usage string) FlagOption
Click to show internal directories.
Click to hide internal directories.