I am looking to add an environment variable to a yaml file from the command line. I used yq. This is the command:
cat mytemplate.yml | yq -Y '.services.samson.environment += {"newKey":"newVal"}'
I keep getting this error:
Error: unknown shorthand flag: 'Y' in -Y
Usage:
yq [flags]
yq [command]
Any work-arounds for this
You are probably confusing yq, the jq wrapper for YAML with yq, the jq reimplementation for YAML which are two different projects.
You have the second one installed but your usage of -Y indicates you need the first one, since only that one has such an option. So you need to uninstall the currently installed yq and then install the other one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With