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

Remove deprecated --argfile option #2768

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

itchyny
Copy link
Contributor

@itchyny itchyny commented Jul 25, 2023

The --argfile option has been documented as Do not use. since jq 1.5. It has been 8 years, so let's remove this.

@wader
Copy link
Member

wader commented Jul 25, 2023

Oh never used i think but assumed it was like --raw-file but is more like --argjsonarrayfirst?

@wader
Copy link
Member

wader commented Jul 25, 2023

Is there some good compatibility argument for keeping it?

@nicowilliams nicowilliams merged commit a29ac81 into jqlang:master Jul 25, 2023
29 checks passed
@nicowilliams
Copy link
Contributor

Thanks!

@pkoppstein
Copy link
Contributor

@wader asked:

Is there some good compatibility argument for keeping it?

Yes, I believe so, mainly because (a) it's all over the internets (google counts 3,260 pages) and (b) there isn't yet a good substitute (e.g. --slurpfile always slurps).

Part of the reason it's been in limbo so long is that there has been some hope that jq's I/O functionality would be significantly overhauled, at which time --argfile would die a natural death.

Anyway, in my opinion, it would have been better to leave it in for 1.7; in fact, maybe it's not too late to revert this particular commit???? @nicowilliams? @itchyny?

@nicowilliams
Copy link
Contributor

@pkoppstein it's been removed. It will stay removed. There was a deprecation warning for a long time. People will adjust.

sixtysecrun added a commit to sixtysecrun/homeage that referenced this pull request Oct 21, 2023
The jq option --argfile was deprecated for a long time and it was
finally removed from jq 1.7.
The alternative is to use --slurpfile option which basically behaves in
a same way.

References:
- jqlang/jq#2768
- https://github.com/jqlang/jq/releases/tag/jq-1.7
sixtysecrun added a commit to sixtysecrun/homeage that referenced this pull request Oct 21, 2023
The jq option --argfile was deprecated for a long time and it was
finally removed from jq 1.7, which is causing the following error in
activation script:

jq: Unknown option --argfile

The alternative is to use --slurpfile option which basically behaves in
a same way.

References:
- jqlang/jq#2768
- https://github.com/jqlang/jq/releases/tag/jq-1.7
@philpax
Copy link

philpax commented Apr 20, 2024

For anyone else coming across this PR who needs to update their existing scripts, and are OK with subpar performance: you can replace --argfile with --slurpfile and index into the resulting array.

Here's an example:

jq -c '{ title, comments: $comments[.name] }' --argfile comments "comments.ndjson" "submissions.ndjson" > output.ndjson

should become

jq -c '{ title, comments: ($comments[0][.name]) }' --slurpfile comments "comments.ndjson" "submissions.ndjson" > output.ndjson

This may not be sufficient for your use case, or there may be better ways of doing it, but this got me back up and running.

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.

None yet

5 participants