yqis quite different from previous versions (and I apologise for that) - however it will be very familiar if you have used
jqbefore as it now uses a similar syntax. Most commands that you could do in
v3are longer in
v4as a result of having a more expressive syntax language.
v4by default now:
v3yq had seperate commands for reading/writing/deleting and more. In
v4all these have been embedded into a single expression you specify to either the
evalcommand (which runs the expression against each yaml document for each file given in sequence) or the
eval-allcommand, which reads all documents of all files, and runs the given expression once.
v3have been put into the expression language, for instance
stripCommentsallowing you to specify which nodes to strip comments from instead of only being able to apply the flag to the entire document.
jq, merge is done via the multiply operator. In yq, the merge operator can take extra options to modify how it works.
v3compatability, use the
noption to only merge in new fields.
yqto run through the expression pipeline - for what it's worth, this is what
jqdoes as well. Instead use the
--null-input/-nflag and pipe out the results to the file you want directly (see example below).
v3so expect to see more features soon!