ANYCONFIG_CLI(1)

πŸ“¦ version 0.14.0, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

okay so this is the manual page for anyconfig_cli β€” specifically anyconfig_cli 0.9.5. The manual name is ANYCONFIG_CLI(1), and bestie, we're about to make it make sense. πŸ’…

✨ SYNOPSIS ✨

the shape of it is literally:

anyconfig_cli [Options...] CONF_PATH_OR_PATTERN_0
[CONF_PATH_OR_PATTERN_1 ..]

πŸ’… OPTIONS πŸ’…

  • --version β€” show the program's version number and exit. iconic little info drop.
  • -h, --help β€” show this help message and exit. the classic save-me button.
  • -L, --list β€” list supported config types. yes bestie, the whole menu.
  • -o OUTPUT, --output=OUTPUT β€” output file path. where the result goes.
  • -I ITYPE, --itype=ITYPE β€” select type of Input config files from ini, json, xml, yaml [Automatically detected by file ext]. if you don't pick, it auto-detects from the 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]. same auto-detect vibe for output.
  • -M MERGE, --merge=MERGE β€” select strategy to merge multiple configs from replace, noreplace, merge_dicts, merge_dicts_and_lists [merge_dicts]. the default is [merge_dicts].
  • -A ARGS, --args=ARGS β€” argument configs to override. drop extra config in here.
  • --atype=ATYPE β€” explicitly select the type of argument to provide configs from ini, json, xml, yaml and so on. If this option is not set, the 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 is {'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 is {'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. no dramatic gasping over absent files.
  • -T, --template β€” enable support to load jinja2 based template configuration files. fancy template hours.
  • -E, --env β€” load configuration defaults from environment values. let the env do its thing.
  • -S SCHEMA, --schema=SCHEMA β€” specify Schema file[s] path. yes, one or more.
  • --validate β€” only validate input files and do not output. You must specify schema file with -S/--schema option. no schema, no validation party.
  • --gen-schema β€” generate JSON schema for givne config file[s] and output it. schema generation moment.
  • -s, --silent β€” silent or quiet mode. shhh era.
  • -q, --quiet β€” same as --silent option. twins.
  • -v, --verbose β€” verbose mode. tell me everything, bestie.

πŸŽ€ EXAMPLES πŸŽ€

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

πŸ¦‹ NOTES πŸ¦‹

  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/

that's the whole manual, bestie! source/version: anyconfig_cli 0.9.5; date: June 2018; manual name: ANYCONFIG_CLI(1). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from