Document $ARGS and friends
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Nicolas Williams · committed by Nicolas Williams · parent 66fb962 · Browse files · 2 files·+28 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+28 added−0 removed
- other:+28 added−0 removed
Provenance
- Commit
ef87010- Tree
76afde4- Author
Nicolas Williams <nico@cryptonector.com>- Committer
Nicolas Williams <nico@cryptonector.com>- Parent
66fb962
2 files changed+28 added−0 removed
modified:docs/content/3.manual/manual.yml+13 added
215 unmodified lines216 available in the program and has the value `"bar"`. Note that217 `value` will be treated as a string, so `--arg foo 123` will218 bind `$foo` to `"123"`.219 220+ Named arguments are also available to the jq program as221+ `$ARGS.named`.222+223 * `--argjson name JSON-text`:224 225 This option passes a JSON-encoded value to the jq program as a226 predefined variable. If you run jq with `--argjson foo 123`, then14 unmodified lines241 (This option is like `--slurpfile`, but when the file has just242 one text, then that is used, else an array of texts is used as243 in `--slurpfile`.)244 245+ * `--args`:246+247+ Remaining arguments are positional string arguments. These are248+ available to the jq program as `$ARGS.positional[]`.249+250+ * `--jsonargs`:251+252+ Remaining arguments are positional JSON text arguments. These253+ are available to the jq program as `$ARGS.positional[]`.254+255 * `--run-tests [filename]`:256 257 Runs the tests in the given file or standard input. This must258 be the last option given and does not honor all preceding2886 unmodified linesmodified:jq.1.prebuilt+15 added
157 unmodified lines158 .159 .IP160 This option passes a value to the jq program as a predefined variable\. If you run jq with \fB\-\-arg foo bar\fR, then \fB$foo\fR is available in the program and has the value \fB"bar"\fR\. Note that \fBvalue\fR will be treated as a string, so \fB\-\-arg foo 123\fR will bind \fB$foo\fR to \fB"123"\fR\.161 .162+.IP163+Named arguments are also available to the jq program as \fB$ARGS\.named\fR\.164+.165 .IP "\(bu" 4166 \fB\-\-argjson name JSON\-text\fR:167 .168 .IP14 unmodified lines183 .IP184 (This option is like \fB\-\-slurpfile\fR, but when the file has just one text, then that is used, else an array of texts is used as in \fB\-\-slurpfile\fR\.)185 .186 .IP "\(bu" 4187+\fB\-\-args\fR:188+.189+.IP190+Remaining arguments are positional string arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\.191+.192+.IP "\(bu" 4193+\fB\-\-jsonargs\fR:194+.195+.IP196+Remaining arguments are positional JSON text arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\.197+.198+.IP "\(bu" 4199 \fB\-\-run\-tests [filename]\fR:200 .201 .IP202 Runs the tests in the given file or standard input\. This must be the last option given and does not honor all preceding options\. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line\. Compilation failure tests start with a line containing only "%%FAIL", then a line containing the program to compile, then a line containing an error message to compare to the actual\.3141 unmodified lines