Documentation ¶
Index ¶
- func GooptFigureBool(names []string, help string) *bool
- func GooptFigureString(names []string, def string, help string) *string
- type Category
- type CategoryMap
- type Config
- func (c *Config) Add(name string) *Option
- func (c *Config) AddBoolean(name string) *Option
- func (c Config) Get(name string) *string
- func (c *Config) GetOptions() map[string]*Option
- func (c *Config) Parse()
- func (c *Config) ParseEnv(passed map[string]bool)
- func (c *Config) ParseFile(passed map[string]bool) error
- type File
- type JsonFile
- type Option
- func (o *Option) Default(def string) *Option
- func (o *Option) Description(desc string) *Option
- func (o *Option) EnvVar(envVar string) *Option
- func (o *Option) FileSpec(spec string) *Option
- func (o Option) GetDefault() string
- func (o Option) GetDescription() string
- func (o Option) GetEnvVar() string
- func (o Option) GetFileSpec() string
- func (o Option) GetLongOpt() string
- func (o Option) GetName() string
- func (o Option) GetShortOpt() string
- func (o *Option) LongOpt(opt string) *Option
- func (o *Option) ShortOpt(opt string) *Option
- type ValueMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GooptFigureBool ¶
Types ¶
type Category ¶
type Category struct { Name string Parent *Category Categories CategoryMap Values ValueMap }
func NewCategory ¶
type CategoryMap ¶
func (CategoryMap) Delete ¶
func (c CategoryMap) Delete(key string)
func (CategoryMap) Exists ¶
func (c CategoryMap) Exists(key string) bool
func (CategoryMap) Get ¶
func (c CategoryMap) Get(key string) *Category
func (CategoryMap) MustGet ¶
func (c CategoryMap) MustGet(key string) *Category
func (CategoryMap) Print ¶
func (c CategoryMap) Print(indent string)
func (CategoryMap) Set ¶
func (c CategoryMap) Set(key string, value *Category)
type Config ¶
type Config struct { Description string DescribeEnvironment bool // if true, the environment variable is automatically added to the flag description DisableCommandLine bool EnvPrefix string EnvOverridesFile bool FileParser File RequireFile bool // application will panic if RequireFile == true, FileParser != nil and file doesn't exist Version string // contains filtered or unexported fields }
Config contains the configuration options that may be set by command line flags and environment variables.
func (*Config) Add ¶
Adds a configuration option, returns an Option instance for easily setting the corresponding environment variable, default value, and description.
func (*Config) AddBoolean ¶
func (*Config) Parse ¶
func (c *Config) Parse()
Parses the configuration options into defined flags, sets the value accordingly. Options are read first from command line flags, then from environment variables, and falls back to the default value if neither are set.
See https://github.com/rakyll/globalconf/blob/master/globalconf.go
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option contains the details of a configuration options, e.g. corresponding environment variable, default value, description.
func (*Option) Description ¶
Sets the configuration options long description.