Documentation ¶
Index ¶
- func Bool(name string, value bool, usage string) *bool
- func Cheating() (bool, string)
- func Duration(name string, value time.Duration, usage string) *time.Duration
- func Float64(name string, value float64, usage string) *float64
- func Get(name string) interface{}
- func Int(name string, value int, usage string) *int
- func Parse(getSystemDefaults func() (*Config, error))
- func ResetToDefaults()
- func Set(name string, value interface{}) error
- func String(name string, value string, usage string) *string
- func StringBoolMap(name string, value map[string]bool, usage string) *map[string]bool
- func SystemDefault(m map[string]interface{}) interface{}
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse parses the command-line flags, then loads the config object using the provided function. Should be called initially, before loading config.
func ResetToDefaults ¶
func ResetToDefaults()
ResetToDefaults returns all flags to their default value.
func StringBoolMap ¶ added in v1.0.59
StringBoolMap is a custom flag type to contain maps from string to bool.
func SystemDefault ¶ added in v1.0.59
func SystemDefault(m map[string]interface{}) interface{}
SystemDefault performs a GOOS/GOARCH dependent value lookup to be used in flag defaults. Map keys shall be */*, GOOS/*, */GOARCH or GOOS/GOARCH.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a JSON serializable type containing the flags.
func Marshal ¶
func Marshal() *Config
Marshal returns a config object for the currently set flags (both those from the config and command line). We only write non-default flag values.
func NoConfig ¶
NoConfig can be passed to Parse if the binary wants to do no config file processing.
func (*Config) MarshalJSON ¶
MarshalJSON returns the JSON representation of the config.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON loads the config from a JSON object string.