Documentation
¶
Overview ¶
Package config locates Nicely's folders and reads the shared and local config files, as the Configuration section of contract.md defines them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load reads the shared file, then the local file over it. A missing file is not an error. A table merges key by key across the files, and any other value, such as a list, replaces the one below it. Unknown keys come back for the CONFIG_UNKNOWN_KEY warning, so an older ncly reads a newer config.
Types ¶
type Config ¶
type Config struct {
Lang string `toml:"lang"`
}
Config holds the keys that this version of ncly knows. A zero value means the default applies.
type InvalidError ¶
InvalidError reports a config file with a syntax error or a value of the wrong type. Line is 0 when the parser does not say where.
func (*InvalidError) Error ¶
func (e *InvalidError) Error() string
func (*InvalidError) Unwrap ¶
func (e *InvalidError) Unwrap() error
type Paths ¶
type Paths struct {
Shared string
// Local is config.local.toml, beside Shared, for this machine only.
Local string
Data string
State string
Cache string
}
Paths locates Nicely's files and folders on this machine.
func Locate ¶
Locate resolves the paths from home and the environment. An XDG variable counts only when it holds an absolute path, as the XDG specification asks. NCLY_CONFIG names another shared file, and the local file moves beside it. Without an absolute home or XDG variable, default paths stay empty instead of resolving from the current folder.