Skip to content

Commit 0fda087

Browse files
committed
Clarify -f argument parsing jqlang#3199.
1 parent 828e6f1 commit 0fda087

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docs/content/manual/manual.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ using some command-line options:
8484

8585
## General options
8686

87-
* `-f filename` / `--from-file filename`:
87+
* `-f` / `--from-file`:
8888

89-
Read filter from the file rather than from a command line, like awk's `-f` option.
89+
Read filter from a file rather than from the command line, like awk's `-f` option.
90+
This changes the filter argument to be interpreted as a filename,
91+
instead of the source of a program.
9092

9193
* `-L directory`:
9294

@@ -2954,7 +2956,7 @@ when writing the "shebang" for a jq script:
29542956
# total - Output the sum of the given arguments (or stdin)
29552957
# usage: total [numbers...]
29562958
# \
2957-
exec jq --args -MRnf "$0" -- "$@"
2959+
exec jq --args -MRnf -- "$0" "$@"
29582960

29592961
$ARGS.positional |
29602962
reduce (
@@ -2974,7 +2976,7 @@ But it is not ignored by `sh`, since in `sh` a backslash at the
29742976
end of the line does not continue the comment.
29752977
With this trick, when the script is invoked as `total 1 2`,
29762978
`/bin/sh -- /path/to/total 1 2` will be run, and `sh` will then
2977-
run `exec jq --args -MRnf /path/to/total -- 1 2` replacing itself
2979+
run `exec jq --args -MRnf -- /path/to/total 1 2` replacing itself
29782980
with a `jq` interpreter invoked with the specified options (`-M`,
29792981
`-R`, `-n`, `--args`), that evaluates the current file (`$0`),
29802982
with the arguments (`$@`) that were passed to `sh`.

docs/man/prologue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ jq -- Command-line JSON processor
88

99
# SYNOPSIS
1010

11-
**jq** `[`_OPTION_`]`... _FILTER_ `[`_FILE_`]`...
11+
**jq** `[`_OPTION_`]`... `[`_FILTER_`]` `[`_FILE_`]`...
1212

1313
# DESCRIPTION

0 commit comments

Comments
 (0)