Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--indent 0 results in 4 spaces instead #1668

Open
avorima opened this issue May 15, 2023 · 2 comments
Open

--indent 0 results in 4 spaces instead #1668

avorima opened this issue May 15, 2023 · 2 comments
Labels

Comments

@avorima
Copy link

avorima commented May 15, 2023

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.

@mikefarah
Copy link
Owner

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 :/

@avorima
Copy link
Author

avorima commented May 23, 2023

Oh, I just found your issue #825. What library would fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants