Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ssato/8cc12afdf7d48d2959961451e045da57 to your computer and use it in GitHub Desktop.
Save ssato/8cc12afdf7d48d2959961451e045da57 to your computer and use it in GitHub Desktop.
anyconfig_cli example to modify the content of YAML file
ssato@x1-carbon-gen6% anyconfig_cli -h | grep -A 20 -E \^Query
Query/Get/set options:
-Q QUERY, --query QUERY
Query with JMESPath expression language. See
http://jmespath.org for more about JMESPath
expression. This option is not used with --get option
at the same time. Please note that python module to
support JMESPath expression
(https://pypi.python.org/pypi/jmespath/) is required
to use this option
--get GET Specify key path to get part of config, for example, '
--get a.b.c' to config {'a': {'b': {'c': 0, 'd': 1}}}
gives 0 and '--get a.b' to the same config gives {'c':
0, 'd': 1}. Path expression can be JSON Pointer
expression (http://tools.ietf.org/html/rfc6901) such
like '', '/a~1b', '/m~0n'. This option is not used
with --query option at the same time.
--set SET 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}}}.
Common options:
ssato@x1-carbon-gen6% anyconfig_cli --get env /usr/share/alacritty/alacritty.yml
TERM: xterm-256color
ssato@x1-carbon-gen6% anyconfig_cli --set env.TERM=xterm /usr/share/alacritty/alacritty.yml | grep -A 5 -E \^env
env:
TERM: xterm
window:
dimensions:
columns: 80
lines: 24
ssato@x1-carbon-gen6% anyconfig_cli -O json --set env.TERM=xterm /usr/share/alacritty/alacritty.yml | jq '.env'
{
"TERM": "xterm"
}
ssato@x1-carbon-gen6%
ssato@x1-carbon-gen6% dnf copr list
copr.fedorainfracloud.org/ssato/extras *
copr.fedorainfracloud.org/ssato/python-anyconfig *
copr.fedorainfracloud.org/tjuberg/i3-desktop *
* These coprs have repo file with an old format that contains no information about Copr hub - the default one was assumed. Re-enable the project to fix this.
ssato@x1-carbon-gen6%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment