Description
Please describe your feature request.
We use yq
in generic tools to make small changes to yaml files across our enterprise. Most are formatted with 2 character indent but some are 4. It would be nice to be able to detect the current indent level and maintain it instead of having to specify a value or use the default.
Describe the solution you'd like
Given these two yaml files:
countries:
- Australia
- USA
and
countries:
- Australia
- USA
Running yq
with write in place without specifying an indent or with a new flag like --preserve-indent
, the two files should both be formatted with the same indentation as they were previously.
Describe alternatives you've considered
Read in the file and detect the current indentation, then pass that to yq
with the write command. I'm not sure how to safely and consistently detect current indentation though. I'll ask in discussions separately.
Additional context
none