Closed ingydotnet closed 2 months ago
Here's some general heuristics:
fy-tool already seems to fold plain scalars. yaml-pp-load doesn't. I think that folding is nice, so keep that.
$ echo $'foo:\n- " x "' | fy-tool -m dejson -
foo:
- " x "
I'd like to see single quotes not double quotes. also you don't seem to fold quoted scalars like you do for plain. That's a shame. :)
Also yamlpp-load-dump --preserve 0
emits ---
at start. This is preferred to state (not too loudly) that this is YAML.
Also start top level scalars on the ---
line
$ echo $'foo\nbar' | yamlpp-load-dump --preserve 0
--- foo bar
Addressed most of these with the 21747066c6684f3b09c60c72fe5dda537706dc82 and de49581ad0cf52c103f9c21f0bffe7e76ff03d05 commits.
fy-tool now accepts -mpretty (or -myamlfmt as an alias).
I'm not so gung-ho to make single quotes as the default for scalars that can't be plain. I'm an old C person and when I see single quotes my lizard brain goes to char
mode...
Closing since this is be OK now.
First off
dejson
is a bad name for this. How aboutyamlfmt
,yfmt
,,tidy
or something? JSON has nothing to do with this.So here are some changes to the default emitter format I'd like to see...
Do those for starters.
In general @perlpunk's
yamlpp-load-dump --preserve 0
does a good job for this kind of formatting. You can install withcpanm YAML::PP
.