anyconfig_cli − manual page for anyconfig_cli 0.9.5
anyconfig_cli [Options...] CONF_PATH_OR_PATTERN_0 [CONF_PATH_OR_PATTERN_1 ..]
−−version
show program’s version number and exit
−h, −−help
show this help message and exit
−L, −−list
List supported config types
−o OUTPUT, −−output=OUTPUT
Output file path
−I ITYPE, −−itype=ITYPE
Select type of Input config files from ini, json, xml, yaml [Automatically detected by file ext]
−O OTYPE, −−otype=OTYPE
Select type of Output config files from ini, json, xml, yaml and so on [Automatically detected by file ext]
−M MERGE, −−merge=MERGE
Select strategy to merge multiple configs from replace, noreplace, merge_dicts, merge_dicts_and_lists [merge_dicts]
−A ARGS, −−args=ARGS
Argument configs to override
−−atype=ATYPE
Explicitly select type of argument to provide configs from ini, json, xml, yaml and so on. If this option is not set, original parser is used: ’K:V’ will become {K: V}, ’K:V_0,V_1,..’ will become {K: [V_0, V_1, ...]}, and ’K_0:V_0;K_1:V_1’ will become {K_0: V_0, K_1: V_1} (where the tyep of K is str, type of V is one of Int, str, etc.
−−query=QUERY
Specify JMESPath expression to query part of config, for example, if a config {’a’: {’b’: {’c’: 0, ’d’: [1, 2, 3]}}} ’--query a.b.d[0]’ gives 1 and ’--query a.b’ gives {’c’: 0, ’d’: [1, 2, 3]}. −−get=GET Specify key path to get part of config, for example, if a config {’a’: {’b’: {’c’: 0, ’d’: 1}}} ’--get a.b.c’ gives 0 and ’--get a.b’ gives {’c’: 0, ’d’: 1}. −−set=GET Specify key path to set (update) part of config, for example, ’--set a.b.c=1’ to a config {’a’: {’b’: {’c’: 0, ’d’: 1}}} gives {’a’: {’b’: {’c’: 1, ’d’: 1}}}.
−x, −−ignore−missing
Ignore missing input files
−T, -−template
Enable support to load jinja2 based template configuration files
−E, −−env
Load configuration defaults from environment values
−S SCHEMA, −−schema=SCHEMA
Specify Schema file[s] path
−−validate
Only validate input files and do not output. You must specify schema file with −S/−−schema option.
−−gen−schema
Generate JSON schema for givne config file[s] and output it.
−s, −−silent
Silent or quiet mode
−q, −−quiet
Same as −−silent option
−v, −−verbose
Verbose mode
List supported configuration types.
anyconfig_cli −−list
Load a YAML config /etc/xyz/conf.d/a.conf and dump parsed result to stdout in JSON format by specifying input and output formats explicitly.
anyconfig_cli −I yaml −O json /etc/xyz/conf.d/a.conf
Similar to the previous example but inputs may be multiple files as the input is glob pattern.
anyconfig_cli −I yaml ’/etc/xyz/conf.d/*.conf’ −o xyz.conf −−otype json
Similar to the previous example but configuration specified w/ −A (−−args) option added.
anyconfig_cli ’/etc/xyz/conf.d/*.json’ −o xyz.yml −−atype json −A ’{"obsoletes": "sysdata", "conflicts": "sysdata−old"}’
Same as the previous example.
anyconfig_cli ’/etc/xyz/conf.d/*.json’ −o xyz.yml −A obsoletes:sysdata;conflicts:sysdata−old
Load multiple JSON files with merge strategy ’noreplace’.
anyconfig_cli -O json ’/etc/foo.d/*.json’ −M noreplace
Get the part of input configuration files.
anyconfig_cli ’/etc/foo.d/*.json’ −−get a.b.c
Set the part of input configuration files.
anyconfig_cli ’/etc/foo.d/*.json’ −−set a.b.c=1
Validate input configuration files with JSON schema.
anyconfig_cli −−validate −S foo.conf.schema.yml ’/etc/foo.d/*.xml’
Generate JSON schema for input configuration files.
anyconfig_cli −−gen−schema ’/etc/foo.d/*.xml’ −o foo.conf.schema.yml
Load environment variables and output it as JSON data.
anyconfig_cli −−env −O json
1. |
python-anyconfig (anyconfig_cli) home page |
https://github.com/ssato/python-anyconfig
2. |
python-anyconfig (anyconfig_cli) Online Doc |
http://python-anyconfig.readthedocs.org/en/latest/