Open
Description
Please describe your feature request.
Currently yq always format arrays in block style, it would be nice to have an option to format arrays in flow style, namely compact arrays.
Describe the solution you'd like
If we have data1.yml like:
(please keep to around 10 lines )
numbers:
- 1
- 2
- 3
And we run a command:
yq --compact-array .numbers data1.yml
it could output a json style array, even if the output format is yaml:
[1, 2, 3]
Describe alternatives you've considered
With PyYAML, there's default_flow_style
option:
import yaml
data = { 'numbers': [1, 2, 3] }
print(yaml.dump(data['numbers'], default_flow_style=True))
# [1, 2, 3]
Additional context
Ideally, only the array of scalar elements should be printed in compact form.