yq icon indicating copy to clipboard operation
yq copied to clipboard

--indent 0 results in 4 spaces instead

Open avorima opened this issue 2 years ago • 3 comments

Describe the bug

Using --indent flag with anything less than or equal to zero results in 4 spaces being used instead.

Version of yq: 4.33.3 Operating system: linux Installed via: pacman, but also reproducible with locally built binary

Input Yaml

data1.yml:

list:
- foo

Command

yq --indent 0 -i '.list[0] = "bar"' data1.yaml

Actual behavior

list:
    - bar

Expected behavior

list:
- bar

Additional context

This isn't limited to the -i (inplace) flag.

avorima avatar May 15 '23 11:05 avorima

Yeah this is what the underlying yaml library does - I believe there is already a bug raised against it - but that library isn't getting much love atm.

I plan on switching to another yaml library hopefully sometime this year. It will be a reasonably big job though :/

mikefarah avatar May 23 '23 05:05 mikefarah

Oh, I just found your issue https://github.com/mikefarah/yq/issues/825. What library would fix this?

avorima avatar May 23 '23 10:05 avorima