Skip to content

Add missing newlines and add flag --no-trailing-newline to not do that#843

Merged
johnbartholomew merged 3 commits intogoogle:masterfrom
johnbartholomew:output-newline
Feb 3, 2026
Merged

Add missing newlines and add flag --no-trailing-newline to not do that#843
johnbartholomew merged 3 commits intogoogle:masterfrom
johnbartholomew:output-newline

Conversation

@johnbartholomew
Copy link
Copy Markdown
Collaborator

Incorporates #819 which fixes #518. And adds a new flag --no-trailing-newline which turns off the extra newline in all modes except --yaml-stream which is not changed.

On the API, a new flag OutputNewlines is added in the VM struct; this defaults to true (set in MakeVM).

The CLI explicitly rejects the combination of --yaml-stream with --no-trailing-newline in order to prevent people from relying on a meaningless combination (perhaps in the future it will be given some meaning).

@johnbartholomew johnbartholomew force-pushed the output-newline branch 2 times, most recently from 0be522e to 34e1282 Compare February 2, 2026 23:53
…ewline on outputs

For google#518 to allow users to
keep current behaviour for --string --multi, which on go-jsonnet emitted
output without adding an extra newline.

--no-trailing-newline works with all modes except --yaml-stream.
To avoid confusion, the CLI explicitly rejects the combination of both
flags used together.
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 44.295% (-0.02%) from 44.314%
when pulling 0d99c17 on johnbartholomew:output-newline
into 264982b on google:master.

@johnbartholomew
Copy link
Copy Markdown
Collaborator Author

Now done in C++ jsonnet as well: google/jsonnet#1283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants