Closed freeseacher closed 5 years ago
This is not the case in practice nor in the spec; section 9.1.3 describes "bare documents" which do not contain the separator.
Is there a specific reason why your use case requires this? Most YAML users don't use the separator, and it's important to match the expectations of most users. It may be possible to add this behavior as optional if there's a strong argument for it.
My use case is pretty simple. i want to deep sort kubernetes manifests. They tend to be unsorted and searching for specific option is a disaster. I store each manifest in one file. There are lots of files. Also i use yamllint. I have to use it because of internal policy. Yamllint out of scope of my configuration and requires explicit doc start.
There are also troubles with indentation in lists. That require to be two spaces. i can't find a good tool to automaticaly fix my yamls according to yamlllint :(
i am talking about https://github.com/kislyuk/yq/issues/52 specifically
i can't find a good tool to automaticaly fix my yamls according to yamlllint :(
c.f. https://github.com/adrienverge/yamllint/issues/62 formatting is out of scope.
This is not the case in practice nor in the spec; section 9.1.3 describes "bare documents" which do not contain the separator.
Is there a specific reason why your use case requires this? Most YAML users don't use the separator, and it's important to match the expectations of most users. It may be possible to add this behavior as optional if there's a strong argument for it.
I'm also quite interested in getting support for the ---
separator (optionally for not breaking any existing clients). A big advantage of using the separator is that you can concatenate multiple yq outputs to a valid multi-document yaml file without additional programming effort.
ping @freeseacher , your PR has conflicts that need to be resolved.
@yaccob I appreciate the concern about this, but you can already do this using existing yq functionality.
>cat f.yaml
foo: bar
>yq . f.yaml f.yaml
{
"foo": "bar"
}
{
"foo": "bar"
}
>yq -y . f.yaml f.yaml
foo: bar
---
foo: bar
At this point I do not judge this feature to be required in yq. I do agree that configurable indentation and/or fixing the indentation defaults in PyYAML would be nice, which is tracked by #52.
https://yaml.org/spec/1.2/spec.html