Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --raw-output0 #101

Open
pkoppstein opened this issue Aug 4, 2023 · 2 comments
Open

Support --raw-output0 #101

pkoppstein opened this issue Aug 4, 2023 · 2 comments

Comments

@pkoppstein
Copy link

The 1.0 beta announcement mentions support for the --nul-output command-line option.

Please note that jq 1.7rc1 has removed that option, and mentions instead:

      --raw-output0         implies -r and output NUL after each output;

It is generally expected that jq 1.7 will be released quite soon, and that the above remarks about jq 1.7rc1 will apply to 1.7 as well.

@baodrate
Copy link
Contributor

baodrate commented Aug 7, 2023

Thanks for the heads up. This was introduced in jqlang/jq#2684. Worth noting that --raw-output0 bails when any outputs contain a NUL:

https://github.com/jqlang/jq/blob/a6920601299913ec5f9c9a8883517ec10dd71ffe/docs/content/manual/manual.yml#L150-L154

On top of renaming --nul-output to --raw-output0, we should add that check to remain consistent with jq.

note that the behavior of -j/--join-output was already inconsistent with jq (in jaq it does not imply -r). I matched that in --nul-output for internal consistency.

@01mf02
Copy link
Owner

01mf02 commented Aug 29, 2023

For now, I have reverted your previous PR, @baod-rate, because of the change in jq.
I think that it would be great to have some option to set the "output terminator string"; let's call it --output-sep for the sake of discussion.
Then the default would be --output-sep "\n", --join would be equivalent to --output-sep "", and the --raw-output0 option would imply --output-sep "\0". On Windows, --output-sep "\r\n" could be useful.
Prohibiting certain characters in the output as foreseen by --raw-output0 seems difficult, though.

@01mf02 01mf02 changed the title jq 1.7 will no longer support --nul-output Support --raw-output0 Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants