Document $ARGS and friends
This commit is contained in:
1 parent
66fb962a66
commit
ef87010059
2 files changed
+28
No files matched your search
@@ -217,6 +217,9 @@ sections:
|
|||||||
`value` will be treated as a string, so `--arg foo 123` will
|
`value` will be treated as a string, so `--arg foo 123` will
|
||||||
bind `$foo` to `"123"`.
|
bind `$foo` to `"123"`.
|
||||||
|
|
||||||
|
Named arguments are also available to the jq program as
|
||||||
|
`$ARGS.named`.
|
||||||
|
|
||||||
* `--argjson name JSON-text`:
|
* `--argjson name JSON-text`:
|
||||||
|
|
||||||
This option passes a JSON-encoded value to the jq program as a
|
This option passes a JSON-encoded value to the jq program as a
|
||||||
@@ -239,6 +242,16 @@ sections:
|
|||||||
one text, then that is used, else an array of texts is used as
|
one text, then that is used, else an array of texts is used as
|
||||||
in `--slurpfile`.)
|
in `--slurpfile`.)
|
||||||
|
|
||||||
|
* `--args`:
|
||||||
|
|
||||||
|
Remaining arguments are positional string arguments. These are
|
||||||
|
available to the jq program as `$ARGS.positional[]`.
|
||||||
|
|
||||||
|
* `--jsonargs`:
|
||||||
|
|
||||||
|
Remaining arguments are positional JSON text arguments. These
|
||||||
|
are available to the jq program as `$ARGS.positional[]`.
|
||||||
|
|
||||||
* `--run-tests [filename]`:
|
* `--run-tests [filename]`:
|
||||||
|
|
||||||
Runs the tests in the given file or standard input. This must
|
Runs the tests in the given file or standard input. This must
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ Sets the exit status of jq to 0 if the last output values was neither \fBfalse\f
|
|||||||
.IP
|
.IP
|
||||||
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\.
|
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\.
|
||||||
.
|
.
|
||||||
|
.IP
|
||||||
|
Named arguments are also available to the jq program as \fB$ARGS\.named\fR\.
|
||||||
|
.
|
||||||
.IP "\(bu" 4
|
.IP "\(bu" 4
|
||||||
\fB\-\-argjson name JSON\-text\fR:
|
\fB\-\-argjson name JSON\-text\fR:
|
||||||
.
|
.
|
||||||
@@ -181,6 +184,18 @@ Do not use\. Use \fB\-\-slurpfile\fR instead\.
|
|||||||
(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\.)
|
(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\.)
|
||||||
.
|
.
|
||||||
.IP "\(bu" 4
|
.IP "\(bu" 4
|
||||||
|
\fB\-\-args\fR:
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
Remaining arguments are positional string arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\.
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
|
\fB\-\-jsonargs\fR:
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
Remaining arguments are positional JSON text arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\.
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
\fB\-\-run\-tests [filename]\fR:
|
\fB\-\-run\-tests [filename]\fR:
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
|
|||||||
Reference in new issue
Block a user