Given following yaml format
value: - 1 - 2 - 3
How to use yq to output
value: [ 1, 2, 3]
You can change the style of the array by running:
yq '.value style="flow"' data.yaml
This sets the 'style' metadata property of the 'value' node to "flow". This actually made me realise I didn't document how style works for arrays, I've updated the documentation to include more examples:
https://mikefarah.gitbook.io/yq/operators/style#set-flow-quote-style
Disclaimer: I wrote yq
Copyright © 2021 Jogjafile Inc.
You can change the style of the array by running:
This sets the 'style' metadata property of the 'value' node to "flow". This actually made me realise I didn't document how style works for arrays, I've updated the documentation to include more examples:
https://mikefarah.gitbook.io/yq/operators/style#set-flow-quote-style
Disclaimer: I wrote yq