Documentation ¶
Index ¶
- func App() app.Apper
- func AutoBind() bool
- func Env() map[string]interface{}
- func Get(key string) interface{}
- func Init(config Configger, onFail ...onfail.OnFail)
- func Load()
- func LoadEnv()
- func LoadLocal() error
- func LoadSystem() error
- func Local() map[string]interface{}
- func Prefix() string
- func System() map[string]interface{}
- type Config
- func (config *Config) App() app.Apper
- func (config *Config) AutoBind() bool
- func (config *Config) Bind(key string) *Config
- func (config *Config) Bool(name string, value bool, usage string)
- func (config *Config) BoolP(name, shorthand string, value bool, usage string)
- func (config *Config) BoolVar(p *bool, name string, value bool, usage string)
- func (config *Config) BoolVarP(p *bool, name, shorthand string, value bool, usage string)
- func (config *Config) Count(name string, by int, usage string)
- func (config *Config) CountP(name, shorthand string, by int, usage string)
- func (config *Config) CountVar(p *int, name string, by int, usage string)
- func (config *Config) CountVarP(p *int, name, shorthand string, by int, usage string)
- func (config *Config) Env() map[string]interface{}
- func (config *Config) FlagSet() Flagger
- func (config *Config) Get(key string) interface{}
- func (config *Config) Init(app app.Apper, flagSet Flagger, prefix string, args ...interface{}) *Config
- func (config *Config) Int(name string, value int, usage string)
- func (config *Config) IntP(name, shorthand string, value int, usage string)
- func (config *Config) IntVar(p *int, name string, value int, usage string)
- func (config *Config) IntVarP(p *int, name, shorthand string, value int, usage string)
- func (config *Config) Load() *Config
- func (config *Config) LoadAndParse()
- func (config *Config) LoadEnv()
- func (config *Config) LoadLocal() error
- func (config *Config) LoadSystem() error
- func (config *Config) Local() map[string]interface{}
- func (config *Config) Parse(arguments []string) error
- func (config *Config) Prefix() string
- func (config *Config) QueueStore(key string, value interface{}) *Config
- func (config *Config) Save() error
- func (config *Config) SetAutoBind(value bool) *Config
- func (config *Config) SetPrefix(value string) *Config
- func (config *Config) String(name, value, usage string)
- func (config *Config) StringP(name, shorthand, value string, usage string)
- func (config *Config) StringVar(p *string, name, value, usage string)
- func (config *Config) StringVarP(p *string, name, shorthand, value string, usage string)
- func (config *Config) System() map[string]interface{}
- type Configger
- type Flagger
- type PFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoBind ¶
func AutoBind() bool
AutoBind gets whether or not to use automatic environment variable binding.
func Env ¶
func Env() map[string]interface{}
Env gets the map of keys to values configured via environment variables.
func Get ¶
func Get(key string) interface{}
Get gets the value associated with key from the configuration sources
func LoadSystem ¶
func LoadSystem() error
LoadSystem loads mappings from the system configuration file.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config describes the app configuration.
func (*Config) AutoBind ¶
AutoBind gets whether or not to use automatic environment variable binding.
func (*Config) Init ¶
func (config *Config) Init(app app.Apper, flagSet Flagger, prefix string, args ...interface{}) *Config
Init initializes a Config.
func (*Config) LoadAndParse ¶
func (config *Config) LoadAndParse()
func (*Config) LoadEnv ¶
func (config *Config) LoadEnv()
LoadEnv loads mappings from environment variables.
func (*Config) LoadSystem ¶
LoadSystem loads mappings from the system configuration file.
func (*Config) QueueStore ¶
QueueStore queues a single key-value pair for storage into the local configuration file upon the next call to Save.
func (*Config) SetAutoBind ¶
SetAutoBind sets whether or not to use automatic environment variable binding.
func (*Config) StringVarP ¶
type Configger ¶
type Configger interface { // App gets the app being configured. App() app.Apper // AutoBind gets whether or not to use automatic environment variable binding. AutoBind() bool // Bind binds the an environment key. Bind(string) Configger // Forward the call to the Flagger. Bool(name string, value bool, usage string) // Forward the call to the Flagger. BoolP(name, shorthand string, value bool, usage string) // Forward the call to the Flagger. BoolVar(p *bool, name string, value bool, usage string) // Forward the call to the Flagger. BoolVarP(p *bool, name, shorthand string, value bool, usage string) // Forward the call to the Flagger. Count(name string, by int, usage string) // Forward the call to the Flagger. CountP(name, shorthand string, by int, usage string) // Forward the call to the Flagger. CountVar(p *int, name string, by int, usage string) // Forward the call to the Flagger. CountVarP(p *int, name, shorthand string, by int, usage string) // Env gets the map of keys to values configured via environment variables. Env() map[string]interface{} // FlagSet gets the flag set used for configuration. FlagSet() Flagger // Get gets the value associated with key from the configuration sources Get(key string) interface{} // Forward the call to the Flagger. Int(name string, value int, usage string) // Forward the call to the Flagger. IntP(name, shorthand string, value int, usage string) // Forward the call to the Flagger. IntVar(p *int, name string, value int, usage string) // Forward the call to the Flagger. IntVarP(p *int, name, shorthand string, value int, usage string) // Load loads mappings from the several sources. Load() Configger // Load and Parse. LoadAndParse() // LoadEnv loads mappings from environment variables. LoadEnv() // LoadLocal loads mappings from the local configuration file. LoadLocal() error // LoadSystem loads mappings from the system configuration file. LoadSystem() error // Local gets the map of keys to values configured locally. Local() map[string]interface{} // Parse parses flags on the command line. Parse(arguments []string) error // Prefix gets the environment variable prefix. Prefix() string // QueueStore queues a single key-value pair for storage into the local configuration file upon the next call to Save. QueueStore(string, interface{}) Configger // Save atomically saves changes to the local configuration file. Save() error // SetAutoBind sets whether or not to use automatic environment variable binding. SetAutoBind(bool) Configger // SetPrefix sets the environment variable prefix. SetPrefix(string) Configger // Forward the call to the Flagger. String(name, value, usage string) // Forward the call to the Flagger. StringP(name, shorthand, value string, usage string) // Forward the call to the Flagger. StringVar(p *string, name, value, usage string) // Forward the call to the Flagger. StringVarP(p *string, name, shorthand, value string, usage string) // System gets the map of keys to values configured system-wide. System() map[string]interface{} }
Configger is the interface for app configuration.
func SetAutoBind ¶
SetAutoBind sets whether or not to use automatic environment variable binding.
type Flagger ¶
type Flagger interface { Bool(string, bool, string) BoolP(string, string, bool, string) BoolVar(*bool, string, bool, string) BoolVarP(*bool, string, string, bool, string) Count(string, int, string) CountP(string, string, int, string) CountVar(*int, string, int, string) CountVarP(*int, string, string, int, string) CountWorks() bool Int(string, int, string) IntP(string, string, int, string) IntVar(*int, string, int, string) IntVarP(*int, string, string, int, string) Parse([]string) error String(string, string, string) StringP(string, string, string, string) StringVar(*string, string, string, string) StringVarP(*string, string, string, string, string) }
Flagger is the interface for a flag replacement library.