Most of the time, the output from get-value can be re-used as YAML and piped again into
shyaml. For anything else than str type, this is consistent. But it is not for str:
cat <<EOF > test.yml
a: |
this is a string with a semicolon: it should remain
a string with semicolon.
EOF
I'm expecting that:
cat test.yml | shyaml get-type a
and
cat test.yml | shyaml get-value a | shyaml get-type
give the same value.
The second crashes.
So it seems that we need a shyaml get-value that outputs YAML quoted strings. This problem comes from the dump function used in shyaml get-value and all over the place. This function is indeed breaking YAML compatibility clearly, by refusing yaml.dump to print the correct value.
Of course, backwards compatibility is important, so we can't just change the behavior of get-value, but we might want to add for instance a -y or --yaml when we are sure we want YAML only.
Most of the time, the output from
get-value
can be re-used as YAML and piped again intoshyaml
. For anything else thanstr
type, this is consistent. But it is not forstr
:I'm expecting that:
and
give the same value.
The second crashes.
So it seems that we need a
shyaml get-value
that outputs YAML quoted strings. This problem comes from thedump
function used inshyaml get-value
and all over the place. This function is indeed breaking YAML compatibility clearly, by refusingyaml.dump
to print the correct value.Of course, backwards compatibility is important, so we can't just change the behavior of
get-value
, but we might want to add for instance a-y
or--yaml
when we are sure we want YAML only.