Configuration files
If a the configuration hasn’t been set yet, the default config forrepository will be returned, including global and system configurations(if they are available).
The Config type
- static
Config.
get_system_config
() - Return a
object representing the system configuration file. - static
Config.
get_global_config
() - Return a
object representing the global configuration file. Config.
addfile
(_path, level=0, force=0)Add a config file instance to an existing config.
- Get each value of a multivar ‘’name’’ as a list of strings.
The optional ‘’regex’’ parameter is expected to be a regular expressionto filter the variables we’re interested in.
Config.
setmultivar
(_name, regex, value)Set a multivar ‘’name’’ to ‘’value’‘. ‘’regexp’’ is a regularexpression to indicate which values to replace.
- The
Config
class has an iterator which can be used to loopthrough all the entries in the configuration. Each element is aConfigEntry
object containing the name, level, and value of eachconfiguration variable. Be aware that this may return multiple versions ofeach entry if they are set multiple times in the configuration files.
The Config
Mapping interface.
When using the mapping interface, the value is returned as astring. In order to apply the git-config parsing rules, you can useConfig.get_bool()
or Config.get_int()
.
Config.
getbool
(_key)- Look up key and parse its value as a boolean as per the git-configrules. Return a boolean value (True or False).
Truthy values are: ‘true’, 1, ‘on’ or ‘yes’. Falsy values are: ‘false’,0, ‘off’ and ‘no’
Config.
getint
(_key)- Look up key and parse its value as an integer as per the git-configrules. Return an integer.
A value can have a suffix ‘k’, ‘m’ or ‘g’ which stand for ‘kilo’,‘mega’ and ‘giga’ respectively.