kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.53k stars 81 forks source link

order of parameters changes behavior #162

Closed alfonz19 closed 1 year ago

alfonz19 commented 1 year ago

I found some weird behavior. Maybe it's just not understanding the documentation or some other error on my part.

If I do:

echo "{\"aaa\": \"123\"}" | yq -S -y -Y
aaa: "123"

echo "{\"aaa\": \"123\"}" | yq -S -Y -y
aaa: '123'

so just the order of flags changes the output. If these are mutually exclusive/overwrite each other, this ^^ should be illegal usage. If they are not, their order should be insignificant. I though that -Y just enables roundtrip mode and it's subset of of -y functionality, and -Y needs to be present extra. IIUC now, these are mutually exclusive, and overwrite each other in fashion whoever comes last wins. If that's true, please make this a little bit clearer in usage page.

kislyuk commented 1 year ago

-Y and -y are mutually exclusive and override each other.

If these are mutually exclusive/overwrite each other, this ^^ should be illegal usage.

There is no standard convention on this behavior.

please make this a little bit clearer in usage page.

I think it's already pretty clear, but PRs with improvements are welcome.