Wrapper for yq for various common tasks so YAML files can be manipulated in a manner to preserver comments and version header.
apt-get install cpanminus
cpanm YAML::yq::Helper
pkg install p5-App-cpanminus p5-File-Slurp
cpanm YAML::yq::Helper
perl Makefile.PL
make
make test
make install
yqh -f <yaml> -a clear_array --var <var>
yqh -f <yaml> -a clear_hash<--var <var>
yqh -f <yaml> -a create_array --var <var> [--vals <vals>]
yqh -f <yaml> -a create_hash --var <var>
yqh -f <yaml> -a dedup_array --var <var>
yqh -f <yaml> -a delete B<--var> <var>
yqh -f <yaml> -a delete_array --var <var>
yqh -f <yaml> -a delete_hash --var <var>
yqh -f <yaml> -a ensure
yqh -f <yaml> -a is_array --var <var>
yqh -f <yaml> -a is_hash --var <var>
yqh -f <yaml> -a is_defined --var <var>
yqh -f <yaml> -a merge_yaml --yaml <yaml> [--mode <mode>]
yqh -f <yaml> -a push_array --var <var> --vals <vals>
yqh -f <yaml> -a set_array --var <var> --vals <vals>
yqh -f <yaml> -a set_hash --var <var> --hash <hash>
yqh -f <yaml> -a set_in_array --var <var> --vals <vals> [--dedup <0/1>]
yqh -f <yaml> -a yaml_diff --yaml <yaml_file_2>
YAML file to operate on.
Default :: undef
Action to perform.
Default :: undef
Variable to set.
Default :: undef
Comma seperate list of array values.
Default :: undef
Comma seperate list of hash values. Each value is a sub string with key/value seperate by a /=/.
Default :: undef
If it should dedup the data for the op.
Default :: 1
Another YAML file to use with like the merge_yaml action or the like.
Default :: undef
Merge mode to use.
Default :: deeply
Clears the specified array.
Requires :: --var
Clears the specified hash.
Requires :: --var
Creates the specified array if it does not exist.
Requires :: --var
Optional :: --vals
Creates the specified hash if it does not exist.
Requires :: --var
Deduplicates an array.
Requires :: --var
Deletes the var without checking the type.
Requires :: --var
Deletes the specified array.
Requires :: --var
Deletes the specified hash.
Requires :: --var
Ensures that the YAML starts with
%YAML $version
---
This is largely for use with stuff used by LibYAML as that sometimes does not play nice when that is missing.
Version 1.1 is used if it is not set.
Returns 0 or 1 based on if it is a array.
Requires :: --var
Returns 0 or 1 based on if it is a hash.
Requires :: --var
Returns 0 or 1 based on if it is defined.
Requires :: --var
Merges the specified YAML into the YAML.
Requires :: --yaml
Optional :: --mode
Pushes a set of items onto an array.
Requires :: --var, --vals
Clears the array and sets it to specified values.
Requires :: --var, --vals
Clears the hash and sets it to specified values.
Requires :: --var, --hash
Make sure a set of values exist in a array and if not add them.
Requires :: --var, --vals
Optional :: --dedup
Diffs the two YAMLs.
Requires :: --yaml