-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow passing the inline jq script after -- #2919
Conversation
|
3892278
to
997b239
Compare
Editing this code made me realise that jq '$ARGS.positional + [ .foo ]' file1 file2 --args str1 str2 --jsonargs '"json1"' '"json2"' '"json3"' --args str3 I never realised that, that's funny. =) |
997b239
to
ea138b9
Compare
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
2b77e2c
to
0188cf8
Compare
Thanks! |
Oops, I should have said "after", not "before" in the title. |
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