xoa.cfgm.cfgargparse
- xoa.cfgm.cfgargparse(cfgspecfile, parser, parse=True, cfgfileopt='--cfgfile', cfgfile='config.cfg', exc=[], extraopts=None, args=None, getparser=False, getargs=True, **kwargs)[source]
Merge configuration and commandline arguments
- Parameters:
cfgspecfile – Config specification file (.ini).
parser –
ArgumentParser
instance.cfgfileopt (optional) – Name of the option used to specify the user config file. Example:
'cfgfile'
creates the option--cfgfile=<config file>
.cfgfile (optional) – Default name for the loaded config file.
exc (optional) – Config option name that must not be used to generated a commandline option.
**kwargs – Extra params are passed to
ConfigManager
initialization.
- Returns:
ConfigObj
args
Tasks –
Initialize a default configuration (
ConfigManager
) from the specification file given bycfgspecfile
.Generate associated commandline options.
Load a user configuration file (specified with the option whose name is given by
cfgfileopt
).Patch this configuration with user supplied options retrieved using the
ArgumentParser
parserparser
.
Technically it combines
ConfigManager
andConfigManager.arg_parse()