Added some documentation on how configuration files should be laid out
This commit is contained in:
parent
e60a990d10
commit
05ddfef584
@ -38,16 +38,24 @@ const (
|
||||
// string
|
||||
TypeString Type = iota
|
||||
|
||||
// image/color.RGBA
|
||||
// Type: image/color.RGBA
|
||||
// Represented as a 24 bit hexidecimal number (case insensitive)
|
||||
// preceded with a # sign where the first two digits represent the red
|
||||
// channel, the middle two digits represent the green channel, and the
|
||||
// last two digits represent the blue channel.
|
||||
TypeColor
|
||||
|
||||
// int
|
||||
// Type: int
|
||||
// An integer literal, like 123456789
|
||||
TypeInteger
|
||||
|
||||
// float64
|
||||
// Type: float64
|
||||
// A floating point literal, like 1234.56789
|
||||
TypeFloat
|
||||
|
||||
// bool
|
||||
// Type: bool
|
||||
// Values true, yes, on, and 1 are all truthy (case insensitive) and
|
||||
// anything else is falsy.
|
||||
TypeBoolean
|
||||
)
|
||||
|
||||
@ -66,7 +74,12 @@ type Config struct {
|
||||
|
||||
// Load loads and parses the files /etc/xdg/<name>/<name>.conf and
|
||||
// <home>/.config/<name>/<name>.conf, unless the corresponding XDG environment
|
||||
// variables are set - then it uses those.
|
||||
// variables are set - then it uses those. Configuration files are divided into
|
||||
// lines where each line may be blank, a comment, or a key-value pair. If the
|
||||
// line is blank or begins with a # character, it is ignored. Else, the line
|
||||
// must have a key and a value separated by a colon. Before they are processed,
|
||||
// leading and trailing whitespace is trimmed from the key and the value. Keys
|
||||
// are case sensitive.
|
||||
func (config *Config) Load (name string) (err error) {
|
||||
if strings.ContainsAny(name, "/\\|:.%") {
|
||||
err = ErrorIllegalName
|
||||
|
Loading…
Reference in New Issue
Block a user