-
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 --
to come just before the jq program
#2918
Comments
There is a workaround: add a
vs.
|
But it does stop parsing options after |
TIL, thanks! I see that it's even documented (which I missed when I skimmed it before). My apologies for the noise. |
|
But it's an interesting report! It's interesting because the program argument is not an option argument, so why is it that we only accept |
--
(double dash)--
to come just before the jq program
--
to come just before the jq program--
(double dash)
@nicowilliams What you are proposing would be a feature request, not a bug. Also I don't think it is very related to the OP. Creating a new issue would be better. |
Actually, I guess it could be considered a bug. I already knew about this quirk of I think Dan was referring to:
That is not really documenting it much, it's probably just bad wording; anyway #2919 now fixes it. |
--
(double dash)--
to come just before the jq program
I reverted the name change; sorry for the noise, I can't brain in the morning ^^ |
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
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
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
Describe the bug
jq
has the somewhat surprising behavior of recognizing additional options after a non-option argument has been encountered. While I won't suggest changing that behavior (due to compatibility concerns), it would be nice ifjq
at least recognized--
as an indication to stop attempting to parse options. This is a pretty commonly-implemented feature of commandline tools.Given that it's currently an error to pass
--
in a context where options are recognized, I don't think it would introduce a compatibility issue.To Reproduce
Expected to remain the same:
Current behavior of
--
:Expected behavior
Suggested behavior of
--
:Environment (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: