Documentation ¶
Overview ¶
Package config handles the configuration files.
Index ¶
- Variables
- type Config
- func (c *Config) Copy() *Config
- func (c *Config) HasOption(section, option string) bool
- func (c *Config) HasSection(name string) bool
- func (c *Config) Load() error
- func (c *Config) Read(r io.Reader) error
- func (c *Config) Save() error
- func (c *Config) Section(name string) *Section
- func (c *Config) SetDefaults(v value.DB)
- func (c *Config) Write(w io.Writer) error
- type Flags
- type Parser
- type Section
Constants ¶
This section is empty.
Variables ¶
var Defaults value.DB = value.DB{}
Defaults contains some default values.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the main configuration manager.
func New ¶
func New() *Config
New creates a new Config object with the global handler attached to it. So _ALL_ instances will work on the same data.
func (*Config) Copy ¶
Copy creates a new Config object with a copy of the data handler, so we can detach from the global parser.
func (*Config) HasSection ¶
HasSection checks if the section exists in the global parser.
func (*Config) Section ¶
Section creates a new Section object with its named section data attached to it. If the section name does not exists, "default" is used.
func (*Config) SetDefaults ¶
SetDefaults set the values from the Defaults global variable. If a section already exists, it will be overriden.
type Flags ¶
type Flags struct { Quiet bool Debug bool Info bool Verbose bool Name string Profile *profile.Profile }
Flags holds some configuration settings that can be overriden from cmd args.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) Map ¶
Map returns a map with section.option as keys with their respective values from the global parser object. The filter string can be empty "" or contain the prefix of the values to filter. In example, if filter is "master", only values from master section ("master.*") will be returned.
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section is the config section manager.
func (*Section) GetBool ¶
GetBool returns the bool value for the named option. If option does not exists or if there's any parsing error, false will be returned as default value.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
Package mbcfg implements config cmd util.
|
Package mbcfg implements config cmd util. |
Package profile handles profiled settings.
|
Package profile handles profiled settings. |
Package value holds the maps for the config parser.
|
Package value holds the maps for the config parser. |