A sweet little formatter for YAML
go install github.com/chainguard-dev/yam@latest
yam a.yaml
Just add --lint
to the command:
yam a.yaml --lint
To expect a gap (empty line) in between child elements of a given node, just pass a yq
-style path to the node, using --gap
. You can use this flag as many times as needed.
yam a.yaml --gap '.'
yam a.yaml --gap '.foo.bar'
yam a.yaml --gap '.people[].address'
yam a.yaml --gap '.recipes[0].ingredients'
yam a.yaml --gap '.types.*.inputs'