Closed jancespivo closed 5 months ago
Huh now that I look at that example in #210; it's actually wrong. It's not assigning the with_entries result to anything. Not sure how it was working before - probably a bug 😓
It should be either:
yq '.nested |= with_entries(.key |= "KEY_" + .)' data1.yaml
or; if you need to use with
:
yq 'with(.nested; . |= with_entries(.key |= "KEY_" + .))' data1.yaml
This also follows with what I documented for with
: https://mikefarah.gitbook.io/yq/operators/with
Describe the bug
yq 'with_entries(.key |= "KEY_" + .)' sample.yml
according to the https://mikefarah.gitbook.io/yq/operators/entries#use-with_entries-to-update-keys works however nested one usingwith
does not:yq 'with(.nested; with_entries(.key |= "KEY_" + .))' sample.yml
Version of yq: 4.44.1 Operating system: linux Installed via: pacman
Input Yaml
sample.yml:
Command The command you ran:
Actual behavior
Expected behavior
Additional context Related to https://github.com/mikefarah/yq/issues/210