I wanted to try using yamlpath (yaml-set in particular) to recreate the first example, even though the usage model doesn’t quite match up. It’s a bit tedious because I don’t think you can do unrelated replacements in a single command:
$ <<<'{}' yaml-set-g ignored.hello -a world | yaml-set-g tabwidth -a 2-F dquote | yaml-set-g trailingComma -a all| yaml-set-g singleQuote -a true-F dquote | yaml-set-g semi -a true-F dquote | yaml-set-g printwidth -a 120-F dquote | yaml-get-p .
Trying to make it neater with Zsh and (forbidden) use of eval:
$ reps=(ignored.hello world tabwidth 2 trailingComma all singleQuote true semi true printwidth 120) cmd=()$ for k v ( ${(kv)reps} ) cmd+=(yaml-set -g $k -a $v -F dquote \|)$ <<<'{}'eval$cmd yaml-get -p .
EDIT: Ugh I can’t figure out how to properly write the less than sign in lemmy comments.
I wanted to try using yamlpath (
yaml-set
in particular) to recreate the first example, even though the usage model doesn’t quite match up. It’s a bit tedious because I don’t think you can do unrelated replacements in a single command:$ <<<'{}' yaml-set -g ignored.hello -a world | yaml-set -g tabwidth -a 2 -F dquote | yaml-set -g trailingComma -a all | yaml-set -g singleQuote -a true -F dquote | yaml-set -g semi -a true -F dquote | yaml-set -g printwidth -a 120 -F dquote | yaml-get -p .
Trying to make it neater with Zsh and (forbidden) use of
eval
:$ reps=(ignored.hello world tabwidth 2 trailingComma all singleQuote true semi true printwidth 120) cmd=() $ for k v ( ${(kv)reps} ) cmd+=(yaml-set -g $k -a $v -F dquote \|) $ <<<'{}' eval $cmd yaml-get -p .
EDIT: Ugh I can’t figure out how to properly write the less than sign in lemmy comments.