1ANYCONFIG_CLI(1) User Commands ANYCONFIG_CLI(1)
2
3
4
6 anyconfig_cli - manual page for anyconfig_cli 0.9.5
7
9 anyconfig_cli [Options...] CONF_PATH_OR_PATTERN_0 [CONF_PATH_OR_PAT‐
10 TERN_1 ..]
11
13 --version
14 show program's version number and exit
15
16 -h, --help
17 show this help message and exit
18
19 -L, --list
20 List supported config types
21
22 -o OUTPUT, --output=OUTPUT
23 Output file path
24
25 -I ITYPE, --itype=ITYPE
26 Select type of Input config files from ini, json, xml, yaml
27 [Automatically detected by file ext]
28
29 -O OTYPE, --otype=OTYPE
30 Select type of Output config files from ini, json, xml, yaml and
31 so on [Automatically detected by file ext]
32
33 -M MERGE, --merge=MERGE
34 Select strategy to merge multiple configs from replace, nore‐
35 place, merge_dicts, merge_dicts_and_lists [merge_dicts]
36
37 -A ARGS, --args=ARGS
38 Argument configs to override
39
40 --atype=ATYPE
41 Explicitly select type of argument to provide configs from ini,
42 json, xml, yaml and so on. If this option is not set, original
43 parser is used: 'K:V' will become {K: V}, 'K:V_0,V_1,..' will
44 become {K: [V_0, V_1, ...]}, and 'K_0:V_0;K_1:V_1' will become
45 {K_0: V_0, K_1: V_1} (where the tyep of K is str, type of V is
46 one of Int, str, etc.
47
48 --query=QUERY
49 Specify JMESPath expression to query part of config, for exam‐
50 ple, if a config {'a': {'b': {'c': 0, 'd': [1, 2, 3]}}} '--query
51 a.b.d[0]' gives 1 and '--query a.b' gives {'c': 0, 'd': [1, 2,
52 3]}. --get=GET Specify key path to get part of config, for
53 example, if a config {'a': {'b': {'c': 0, 'd': 1}}} '--get
54 a.b.c' gives 0 and '--get a.b' gives {'c': 0, 'd': 1}.
55 --set=GET Specify key path to set (update) part of config, for
56 example, '--set a.b.c=1' to a config {'a': {'b': {'c': 0, 'd':
57 1}}} gives {'a': {'b': {'c': 1, 'd': 1}}}.
58
59 -x, --ignore-missing
60 Ignore missing input files
61
62 -T, --template
63 Enable support to load jinja2 based template configuration files
64
65 -E, --env
66 Load configuration defaults from environment values
67
68 -S SCHEMA, --schema=SCHEMA
69 Specify Schema file[s] path
70
71 --validate
72 Only validate input files and do not output. You must specify
73 schema file with -S/--schema option.
74
75 --gen-schema
76 Generate JSON schema for givne config file[s] and output it.
77
78 -s, --silent
79 Silent or quiet mode
80
81 -q, --quiet
82 Same as --silent option
83
84 -v, --verbose
85 Verbose mode
86
88 List supported configuration types.
89
90 anyconfig_cli --list
91
92 Load a YAML config /etc/xyz/conf.d/a.conf and dump parsed result to
93 stdout in JSON format by specifying input and output formats explic‐
94 itly.
95
96 anyconfig_cli -I yaml -O json /etc/xyz/conf.d/a.conf
97
98 Similar to the previous example but inputs may be multiple files as the
99 input is glob pattern.
100
101 anyconfig_cli -I yaml '/etc/xyz/conf.d/*.conf' -o xyz.conf --otype
102 json
103
104 Similar to the previous example but configuration specified w/ -A
105 (--args) option added.
106
107 anyconfig_cli '/etc/xyz/conf.d/*.json' -o xyz.yml --atype json -A
108 '{"obsoletes": "sysdata", "conflicts": "sysdata-old"}'
109
110 Same as the previous example.
111
112 anyconfig_cli '/etc/xyz/conf.d/*.json' -o xyz.yml -A obsoletes:sys‐
113 data;conflicts:sysdata-old
114
115 Load multiple JSON files with merge strategy 'noreplace'.
116
117 anyconfig_cli -O json '/etc/foo.d/*.json' -M noreplace
118
119 Get the part of input configuration files.
120
121 anyconfig_cli '/etc/foo.d/*.json' --get a.b.c
122
123 Set the part of input configuration files.
124
125 anyconfig_cli '/etc/foo.d/*.json' --set a.b.c=1
126
127 Validate input configuration files with JSON schema.
128
129 anyconfig_cli --validate -S foo.conf.schema.yml '/etc/foo.d/*.xml'
130
131 Generate JSON schema for input configuration files.
132
133 anyconfig_cli --gen-schema '/etc/foo.d/*.xml' -o
134 foo.conf.schema.yml
135
136 Load environment variables and output it as JSON data.
137
138 anyconfig_cli --env -O json
139
141 1. python-anyconfig (anyconfig_cli) home page
142 https://github.com/ssato/python-anyconfig
143
144 2. python-anyconfig (anyconfig_cli) Online Doc
145 http://python-anyconfig.readthedocs.org/en/latest/
146
147
148
149anyconfig_cli 0.9.5 June 2018 ANYCONFIG_CLI(1)