Allow passing the inline jq script after -- - #2919
Merged
Merged
Conversation
Member
Author
|
|
emanuele6
force-pushed
the
allowscriptasarg
branch
6 times, most recently
from
October 3, 2023 03:16
3892278 to
997b239
Compare
emanuele6
commented
Oct 3, 2023
Member
Author
|
Editing this code made me realise that jq '$ARGS.positional + [ .foo ]' file1 file2 --args str1 str2 --jsonargs '"json1"' '"json2"' '"json3"' --args str3I never realised that, that's funny. =) |
emanuele6
force-pushed
the
allowscriptasarg
branch
from
October 3, 2023 03:24
997b239 to
ea138b9
Compare
nicowilliams
reviewed
Oct 3, 2023
emanuele6
force-pushed
the
allowscriptasarg
branch
from
October 3, 2023 04:14
ea138b9 to
2b77e2c
Compare
jq previously only allowed passing the inline script before -- (as if they were options) even though one would expect the inline script to be a positional argument. Since jq previously also refused to run with a usage error if the script was passed after -- (It was not assuming . as script as it does when no arguments are passed), and positional arguments are allowed before -- and even before other options, it should not be a breaking change to change that weird behaviour, and allow the script to appear after --. It also simplifies the option parsing code a bunch. Fixes jqlang#2918
emanuele6
force-pushed
the
allowscriptasarg
branch
from
October 4, 2023 04:11
2b77e2c to
0188cf8
Compare
Contributor
|
Thanks! |
Member
Author
|
Oops, I should have said "after", not "before" in the title. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jq previously only allowed passing the inline script before
--(as if they were options) even though one would expect the inline script to be a positional argument.Since jq previously also refused to run with a usage error if the script was passed after
--(It was not assuming.as script as it does when no arguments are passed), and positional arguments are allowed before--and even before other options, it should not be a breaking change to change that weird behaviour, and allow the script to appear after--.It also simplifies the option parsing code a bunch.
Fixes #2918