-
-
Notifications
You must be signed in to change notification settings - Fork 712
Description
Add an option to convert keys to upper case, to be used with the "shell" output format. This is to produce output that conforms with the usual shell environment variable naming convention of upper case. And to make use of the environment variables in scripts more readable.
Based on a previous discussion Q&A about converting all keys to lower case case, the following appears to accomplish this. However, this is cumbersome for our use case of maintaining configuration files in YAML or JSON format and converting them at runtime for use in shell scripts.
yq '(.. | select(type == "!!map")) |= with_entries(.key |= upcase)' -o shell
We can of course wrap this in a shell function, so I won't be too disappointed if it isn't something that makes sense for yq to do natively.