jsonnet icon indicating copy to clipboard operation
jsonnet copied to clipboard

Document -S (--string) in language reference (and maybe tutorial, too).

Open gjolund opened this issue 4 years ago • 6 comments

Not much else to say.

$ jsonnet --version && cat test.jsonnet && echo  && jsonnet test.jsonnet 
Jsonnet commandline interpreter v0.16.0
local wrapper = [
  {
    some_prop: true
  }
];

std.manifestYamlDoc(wrapper)
"- \"some_prop\": true"

gjolund avatar Oct 17 '20 23:10 gjolund

Try passing the --string flag to the jsonnet tool.

seh avatar Oct 18 '20 00:10 seh

Yep. Jsonnet formats the output as JSON by default. The function manifestYamlDoc returns a string, so the output is formatted as JSON string which contains your YAML. When you pass -S/--string, the output string is printed verbatim.

sbarzowski avatar Oct 18 '20 08:10 sbarzowski

Do you mind pointing me to where in the documentation it says this?

I have been going off this and it did not mention any of this https://jsonnet.org/ref/stdlib.html

gjolund avatar Oct 18 '20 15:10 gjolund

image

That said, we should probably document -S option in reference and/or tutorial. It is described in https://jsonnet.org/articles/output-formats.html, but it's so important that we should mention it in other places too.

sbarzowski avatar Oct 19 '20 08:10 sbarzowski

Thanks for the response. A line or two of options docs would have saved me an hour of debugging there

gjolund avatar Oct 21 '20 11:10 gjolund

I think we can still document it better. This is a pretty basic feature and should be mentioned in the tutorial. Reopening.

sbarzowski avatar Jan 28 '21 14:01 sbarzowski