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

Clarify -f argument parsing #3199

Merged
merged 1 commit into from
Nov 9, 2024
Merged

Conversation

thaliaarchi
Copy link
Contributor

This clarifies the behavior of -f / --from-file in the manual and usage. It does not actually take an argument, as documented and commonly believed; it instead modifies the required filter positional argument.

Thus, the following are perfectly valid, though one might assume they are not with the previous documentation:

  • jq -fn f.jq
  • jq -f -n f.jq
  • jq f.jq -f
  • jq --args -f f.jq
  • jq --args -f -- f.jq
  • jq --args f.jq -f
  • jq --jsonargs -f f.jq

@emanuele6
Copy link
Member

Thank you; can you also fix exec jq --args -MRnf "$0" -- "$@" in the example script?

"$0" should go after -- so exec jq --args -MRfn -- "$0" "$@"

@thaliaarchi
Copy link
Contributor Author

Good point. Fixed.

@wader wader merged commit 32a304b into jqlang:master Nov 9, 2024
29 checks passed
@01mf02
Copy link

01mf02 commented Nov 11, 2024

Thank you for clarifying this; I was also under the misconception that -f takes an argument. Now I have corrected this in my alternative jq interpreter jaq 01mf02/jaq@2ab2e94. The code has even become smaller due to this change. :)

01mf02 added a commit to 01mf02/jq that referenced this pull request Nov 14, 2024
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

Successfully merging this pull request may close these issues.

4 participants