-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
List Values Are Unindented #25
Comments
The format produced by `gopkg.in/yaml.v2` produces output while valid is not easy to read especially for arrays. Adds formatter to handle formatting the marshalled yaml content. Applies similar logic used by `encoding/json.Indent`. Resolves: #25
Hej, any updates on this ? This behaviour is indeed not great. Yaml lists should be indented although technically they don't have to. I saw the referenced PR #43 got closed, not merged. |
The latest release https://github.com/mikefarah/yq/releases/tag/3.1.0 has a indent flag, if this is set to 4 or greater then the lists will be indented - where as an indent of 2 is not. Not sure why this is the case - this is what the underlying yaml parser does... |
An unrelated Not a biggie as it's possible to use a yaml pretty-printer on it after. |
I can't tell if this is expected, or a bug. Let's say I have the following Yaml file:
and I run the following command: `yaml write -i mybooks.yml author "J.K. Rowling"
The updated Yaml file now looks like:
This GitHub Issue is due to the fact that the 'tags' list has lost its indention. That didn't look like valid Yaml to me so I ran it through http://www.yamllint.com/. While the Yaml did validate, the
tags
list was "corrected" to the indention I had it previously. So is this a bug?Also, as you can see, the quotes around the strings are gone. I can see from this issue that it's because of the parser so I guess we can't do anything about it. Sucks though.
The text was updated successfully, but these errors were encountered: