summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-25 15:24:54 +0900
committerGitHub <noreply@github.com>2023-07-25 15:24:54 +0900
commit4705a22c7d8e9238161cbba9b6bad875155e28df (patch)
treeb1a27483b8ad39124d20f331e31a1a6cc0c65252 /docs
parent8f49600a6b717ada5973d518a9f042a4f2f8c58b (diff)
Reorder the command line options in the manual (#2766)
Diffstat (limited to 'docs')
-rw-r--r--docs/content/manual/manual.yml174
-rw-r--r--docs/content/manual/v1.3/manual.yml36
-rw-r--r--docs/content/manual/v1.4/manual.yml86
-rw-r--r--docs/content/manual/v1.5/manual.yml138
-rw-r--r--docs/content/manual/v1.6/manual.yml142
5 files changed, 296 insertions, 280 deletions
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml
index d629900f..6fe2de79 100644
--- a/docs/content/manual/manual.yml
+++ b/docs/content/manual/manual.yml
@@ -104,60 +104,24 @@ sections:
You can affect how jq reads and writes its input and output
using some command-line options:
- * `--version`/`-V`:
+ * `--null-input` / `-n`:
- Output the jq version and exit with zero.
-
- * `--seq`:
-
- Use the `application/json-seq` MIME type scheme for separating
- JSON texts in jq's input and output. This means that an ASCII
- RS (record separator) character is printed before each value on
- output and an ASCII LF (line feed) is printed after every
- output. Input JSON texts that fail to parse are ignored (but
- warned about), discarding all subsequent input until the next
- RS. This mode also parses the output of jq without the `--seq`
- option.
-
- * `--stream`:
-
- Parse the input in streaming fashion, outputting arrays of path
- and leaf values (scalars and empty arrays or empty objects).
- For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
- becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
-
- This is useful for processing very large inputs. Use this in
- conjunction with filtering and the `reduce` and `foreach` syntax
- to reduce large inputs incrementally.
-
- * `--stream-errors`:
-
- Like `--stream`, but invalid JSON inputs yield array values
- where the first element is the error and the second is a path.
- For example, `["a",n]` produces ["Invalid literal at line 1,
- column 9",[1]]`.
-
- Implies `--stream`. Invalid JSON inputs produce no error values
- when `--stream` without `--stream-errors`.
-
- * `--slurp`/`-s`:
-
- Instead of running the filter for each JSON object in the
- input, read the entire input stream into a large array and run
- the filter just once.
+ Don't read any input at all. Instead, the filter is run once
+ using `null` as the input. This is useful when using jq as a
+ simple calculator or to construct JSON data from scratch.
- * `--raw-input`/`-R`:
+ * `--raw-input` / `-R`:
Don't parse the input as JSON. Instead, each line of text is
passed to the filter as a string. If combined with `--slurp`,
then the entire input is passed to the filter as a single long
string.
- * `--null-input`/`-n`:
+ * `--slurp` / `-s`:
- Don't read any input at all! Instead, the filter is run once
- using `null` as the input. This is useful when using jq as a
- simple calculator or to construct JSON data from scratch.
+ Instead of running the filter for each JSON object in the
+ input, read the entire input stream into a large array and run
+ the filter just once.
* `--compact-output` / `-c`:
@@ -165,13 +129,33 @@ sections:
will result in more compact output by instead putting each
JSON object on a single line.
- * `--tab`:
+ * `--raw-output` / `-r`:
- Use a tab for each indentation level instead of two spaces.
+ With this option, if the filter's result is a string then it
+ will be written directly to standard output rather than being
+ formatted as a JSON string with quotes. This can be useful for
+ making jq filters talk to non-JSON-based systems.
- * `--indent n`:
+ * `--join-output` / `-j`:
- Use the given number of spaces (no more than 7) for indentation.
+ Like `-r` but jq won't print a newline after each output.
+
+ * `--nul-output` / `-0`:
+
+ Like `-r` but jq will print NUL instead of newline after each output.
+ This can be useful when the values being output can contain newlines.
+
+ * `--ascii-output` / `-a`:
+
+ jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
+ if the input specified them as escape sequences (like
+ "\u03bc"). Using this option, you can force jq to produce pure
+ ASCII output with every non-ASCII character replaced with the
+ equivalent escape sequence.
+
+ * `--sort-keys` / `-S`:
+
+ Output the fields of each object with the keys in sorted order.
* `--color-output` / `-C` and `--monochrome-output` / `-M`:
@@ -184,19 +168,13 @@ sections:
Colors can be configured with the `JQ_COLORS` environment
variable (see below).
- * `--binary` / `-b`:
+ * `--tab`:
- Windows users using WSL, MSYS2, or Cygwin, should use this option
- when using a native jq.exe, otherwise jq will turn newlines (LFs)
- into carriage-return-then-newline (CRLF).
+ Use a tab for each indentation level instead of two spaces.
- * `--ascii-output` / `-a`:
+ * `--indent n`:
- jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
- if the input specified them as escape sequences (like
- "\u03bc"). Using this option, you can force jq to produce pure
- ASCII output with every non-ASCII character replaced with the
- equivalent escape sequence.
+ Use the given number of spaces (no more than 7) for indentation.
* `--unbuffered`:
@@ -204,49 +182,49 @@ sections:
you're piping a slow data source into jq and piping jq's
output elsewhere).
- * `--sort-keys` / `-S`:
+ * `--stream`:
- Output the fields of each object with the keys in sorted order.
+ Parse the input in streaming fashion, outputting arrays of path
+ and leaf values (scalars and empty arrays or empty objects).
+ For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
+ becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
- * `--raw-output` / `-r`:
+ This is useful for processing very large inputs. Use this in
+ conjunction with filtering and the `reduce` and `foreach` syntax
+ to reduce large inputs incrementally.
- With this option, if the filter's result is a string then it
- will be written directly to standard output rather than being
- formatted as a JSON string with quotes. This can be useful for
- making jq filters talk to non-JSON-based systems.
+ * `--stream-errors`:
- * `--join-output` / `-j`:
+ Like `--stream`, but invalid JSON inputs yield array values
+ where the first element is the error and the second is a path.
+ For example, `["a",n]` produces `["Invalid literal at line 1,
+ column 7",[1]]`.
- Like `-r` but jq won't print a newline after each output.
+ Implies `--stream`. Invalid JSON inputs produce no error values
+ when `--stream` without `--stream-errors`.
- * `--nul-output` / `-0`:
+ * `--seq`:
- Like `-r` but jq will print NUL instead of newline after each output.
- This can be useful when the values being output can contain newlines.
+ Use the `application/json-seq` MIME type scheme for separating
+ JSON texts in jq's input and output. This means that an ASCII
+ RS (record separator) character is printed before each value on
+ output and an ASCII LF (line feed) is printed after every
+ output. Input JSON texts that fail to parse are ignored (but
+ warned about), discarding all subsequent input until the next
+ RS. This mode also parses the output of jq without the `--seq`
+ option.
* `-f filename` / `--from-file filename`:
Read filter from the file rather than from a command line, like
awk's -f option. You can also use '#' to make comments.
- * `-Ldirectory` / `-L directory`:
+ * `-L directory`:
Prepend `directory` to the search list for modules. If this
option is used then no builtin search list is used. See the
section on modules below.
- * `-e` / `--exit-status`:
-
- Sets the exit status of jq to 0 if the last output value was
- neither `false` nor `null`, 1 if the last output value was
- either `false` or `null`, or 4 if no valid result was ever
- produced. Normally jq exits with 2 if there was any usage
- problem or system error, 3 if there was a jq program compile
- error, or 0 if the jq program ran.
-
- Another way to set the exit status is with the `halt_error`
- builtin function.
-
* `--arg name value`:
This option passes a value to the jq program as a predefined
@@ -297,6 +275,32 @@ sections:
Remaining arguments are positional JSON text arguments. These
are available to the jq program as `$ARGS.positional[]`.
+ * `--exit-status` / `-e`:
+
+ Sets the exit status of jq to 0 if the last output value was
+ neither `false` nor `null`, 1 if the last output value was
+ either `false` or `null`, or 4 if no valid result was ever
+ produced. Normally jq exits with 2 if there was any usage
+ problem or system error, 3 if there was a jq program compile
+ error, or 0 if the jq program ran.
+
+ Another way to set the exit status is with the `halt_error`
+ builtin function.
+
+ * `--binary` / `-b`:
+
+ Windows users using WSL, MSYS2, or Cygwin, should use this option
+ when using a native jq.exe, otherwise jq will turn newlines (LFs)
+ into carriage-return-then-newline (CRLF).
+
+ * `--version` / `-V`:
+
+ Output the jq version and exit with zero.
+
+ * `--help` / `-h`:
+
+ Output the jq help and exit with zero.
+
* `--`:
Terminates argument processing. Remaining arguments are
@@ -311,7 +315,7 @@ sections:
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,
+ only `%%FAIL`, then a line containing the program to compile,
then a line containing an error message to compare to the
actual.
diff --git a/docs/content/manual/v1.3/manual.yml b/docs/content/manual/v1.3/manual.yml
index 375799be..c018e314 100644
--- a/docs/content/manual/v1.3/manual.yml
+++ b/docs/content/manual/v1.3/manual.yml
@@ -82,24 +82,24 @@ sections:
You can affect how jq reads and writes its input and output
using some command-line options:
- * `--slurp`/`-s`:
+ * `--null-input` / `-n`:
- Instead of running the filter for each JSON object in the
- input, read the entire input stream into a large array and run
- the filter just once.
+ Don't read any input at all. Instead, the filter is run once
+ using `null` as the input. This is useful when using jq as a
+ simple calculator or to construct JSON data from scratch.
- * `--raw-input`/`-R`:
+ * `--raw-input` / `-R`:
Don't parse the input as JSON. Instead, each line of text is
passed to the filter as a string. If combined with `--slurp`,
then the entire input is passed to the filter as a single long
string.
- * `--null-input`/`-n`:
+ * `--slurp` / `-s`:
- Don't read any input at all! Instead, the filter is run once
- using `null` as the input. This is useful when using jq as a
- simple calculator or to construct JSON data from scratch.
+ Instead of running the filter for each JSON object in the
+ input, read the entire input stream into a large array and run
+ the filter just once.
* `--compact-output` / `-c`:
@@ -107,11 +107,12 @@ sections:
will result in more compact output by instead putting each
JSON object on a single line.
- * `--color-output` / `-C` and `--monochrome-output` / `-M`:
+ * `--raw-output` / `-r`:
- By default, jq outputs colored JSON if writing to a
- terminal. You can force it to produce color even if writing to
- a pipe or a file using `-C`, and disable color with `-M`.
+ With this option, if the filter's result is a string then it
+ will be written directly to standard output rather than being
+ formatted as a JSON string with quotes. This can be useful for
+ making jq filters talk to non-JSON-based systems.
* `--ascii-output` / `-a`:
@@ -121,12 +122,11 @@ sections:
ASCII output with every non-ASCII character replaced with the
equivalent escape sequence.
- * `--raw-output` / `-r`:
+ * `--color-output` / `-C` and `--monochrome-output` / `-M`:
- With this option, if the filter's result is a string then it
- will be written directly to standard output rather than being
- formatted as a JSON string with quotes. This can be useful for
- making jq filters talk to non-JSON-based systems.
+ By default, jq outputs colored JSON if writing to a
+ terminal. You can force it to produce color even if writing to
+ a pipe or a file using `-C`, and disable color with `-M`.
* `--arg name value`:
diff --git a/docs/content/manual/v1.4/manual.yml b/docs/content/manual/v1.4/manual.yml
index 0af395bf..6cc1c591 100644
--- a/docs/content/manual/v1.4/manual.yml
+++ b/docs/content/manual/v1.4/manual.yml
@@ -93,46 +93,43 @@ sections:
You can affect how jq reads and writes its input and output
using some command-line options:
- * `--version`/`-V`:
+ * `--null-input` / `-n`:
- Output the jq version and exit with zero.
+ Don't read any input at all. Instead, the filter is run once
+ using `null` as the input. This is useful when using jq as a
+ simple calculator or to construct JSON data from scratch.
+
+ * `--raw-input` / `-R`:
+
+ Don't parse the input as JSON. Instead, each line of text is
+ passed to the filter as a string. If combined with `--slurp`,
+ then the entire input is passed to the filter as a single long
+ string.
- * `--slurp`/`-s`:
+ * `--slurp` / `-s`:
Instead of running the filter for each JSON object in the
input, read the entire input stream into a large array and run
the filter just once.
- * `--online-input`/`-I`:
+ * `--online-input` / `-I`:
When the top-level input value is an array produce its elements
instead of the array. This allows on-line processing of
potentially very large top-level arrays' elements.
- * `--raw-input`/`-R`:
-
- Don't parse the input as JSON. Instead, each line of text is
- passed to the filter as a string. If combined with `--slurp`,
- then the entire input is passed to the filter as a single long
- string.
-
- * `--null-input`/`-n`:
-
- Don't read any input at all! Instead, the filter is run once
- using `null` as the input. This is useful when using jq as a
- simple calculator or to construct JSON data from scratch.
-
* `--compact-output` / `-c`:
By default, jq pretty-prints JSON output. Using this option
will result in more compact output by instead putting each
JSON object on a single line.
- * `--color-output` / `-C` and `--monochrome-output` / `-M`:
+ * `--raw-output` / `-r`:
- By default, jq outputs colored JSON if writing to a
- terminal. You can force it to produce color even if writing to
- a pipe or a file using `-C`, and disable color with `-M`.
+ With this option, if the filter's result is a string then it
+ will be written directly to standard output rather than being
+ formatted as a JSON string with quotes. This can be useful for
+ making jq filters talk to non-JSON-based systems.
* `--ascii-output` / `-a`:
@@ -142,37 +139,27 @@ sections:
ASCII output with every non-ASCII character replaced with the
equivalent escape sequence.
- * `--unbuffered`:
-
- Flush the output after each JSON object is printed (useful if
- you're piping a slow data source into jq and piping jq's
- output elsewhere).
-
* `--sort-keys` / `-S`:
Output the fields of each object with the keys in sorted order.
- * `--raw-output` / `-r`:
+ * `--color-output` / `-C` and `--monochrome-output` / `-M`:
- With this option, if the filter's result is a string then it
- will be written directly to standard output rather than being
- formatted as a JSON string with quotes. This can be useful for
- making jq filters talk to non-JSON-based systems.
+ By default, jq outputs colored JSON if writing to a
+ terminal. You can force it to produce color even if writing to
+ a pipe or a file using `-C`, and disable color with `-M`.
+
+ * `--unbuffered`:
+
+ Flush the output after each JSON object is printed (useful if
+ you're piping a slow data source into jq and piping jq's
+ output elsewhere).
* `-f filename` / `--from-file filename`:
Read filter from the file rather than from a command line, like
awk's -f option. You can also use '#' to make comments.
- * `-e` / `--exit-status`:
-
- Sets the exit status of jq to 0 if the last output value was
- neither `false` nor `null`, 1 if the last output value was
- either `false` or `null`, or 4 if no valid result was ever
- produced. Normally jq exits with 2 if there was any usage
- problem or system error, 3 if there was a jq program compile
- error, or 0 if the jq program ran.
-
* `--arg name value`:
This option passes a value to the jq program as a predefined
@@ -187,6 +174,23 @@ sections:
program and has the value resulting from parsing the content of
the file named `bar`.
+ * `--exit-status` / `-e`:
+
+ Sets the exit status of jq to 0 if the last output value was
+ neither `false` nor `null`, 1 if the last output value was
+ either `false` or `null`, or 4 if no valid result was ever
+ produced. Normally jq exits with 2 if there was any usage
+ problem or system error, 3 if there was a jq program compile
+ error, or 0 if the jq program ran.
+
+ * `--version` / `-V`:
+
+ Output the jq version and exit with zero.
+
+ * `--help` / `-h`:
+
+ Output the jq help and exit with zero.
+
- title: Basic filters
entries:
- title: "`.`"
diff --git a/docs/content/manual/v1.5/manual.yml b/docs/content/manual/v1.5/manual.yml
index 71ce31bb..cd5ad4ea 100644
--- a/docs/content/manual/v1.5/manual.yml
+++ b/docs/content/manual/v1.5/manual.yml
@@ -95,50 +95,24 @@ sections:
You can affect how jq reads and writes its input and output
using some command-line options:
- * `--version`/`-V`:
+ * `--null-input` / `-n`:
- Output the jq version and exit with zero.
-
- * `--seq`:
-
- Use the `application/json-seq` MIME type scheme for separating
- JSON texts in jq's input and output. This means that an ASCII
- RS (record separator) character is printed before each value on
- output and an ASCII LF (line feed) is printed after every
- output. Input JSON texts that fail to parse are ignored (but
- warned about), discarding all subsequent input until the next
- RS. This mode also parses the output of jq without the `--seq`
- option.
-
- * `--stream`:
-
- Parse the input in streaming fashion, outputting arrays of path
- and leaf values (scalars and empty arrays or empty objects).
- For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
- becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
-
- This is useful for processing very large inputs. Use this in
- conjunction with filtering and the `reduce` and `foreach` syntax
- to reduce large inputs incrementally.
-
- * `--slurp`/`-s`:
-
- Instead of running the filter for each JSON object in the
- input, read the entire input stream into a large array and run
- the filter just once.
+ Don't read any input at all. Instead, the filter is run once
+ using `null` as the input. This is useful when using jq as a
+ simple calculator or to construct JSON data from scratch.
- * `--raw-input`/`-R`:
+ * `--raw-input` / `-R`:
Don't parse the input as JSON. Instead, each line of text is
passed to the filter as a string. If combined with `--slurp`,
then the entire input is passed to the filter as a single long
string.
- * `--null-input`/`-n`:
+ * `--slurp` / `-s`:
- Don't read any input at all! Instead, the filter is run once
- using `null` as the input. This is useful when using jq as a
- simple calculator or to construct JSON data from scratch.
+ Instead of running the filter for each JSON object in the
+ input, read the entire input stream into a large array and run
+ the filter just once.
* `--compact-output` / `-c`:
@@ -146,19 +120,16 @@ sections:
will result in more compact output by instead putting each
JSON object on a single line.
- * `--tab`:
-
- Use a tab for each indentation level instead of two spaces.
-
- * `--indent n`:
+ * `--raw-output` / `-r`:
- Use the given number of spaces (no more than 7) for indentation.
+ With this option, if the filter's result is a string then it
+ will be written directly to standard output rather than being
+ formatted as a JSON string with quotes. This can be useful for
+ making jq filters talk to non-JSON-based systems.
- * `--color-output` / `-C` and `--monochrome-output` / `-M`:
+ * `--join-output` / `-j`:
- By default, jq outputs colored JSON if writing to a
- terminal. You can force it to produce color even if writing to
- a pipe or a file using `-C`, and disable color with `-M`.
+ Like `-r` but jq won't print a newline after each output.
* `--ascii-output` / `-a`:
@@ -168,47 +139,63 @@ sections:
ASCII output with every non-ASCII character replaced with the
equivalent escape sequence.
+ * `--sort-keys` / `-S`:
+
+ Output the fields of each object with the keys in sorted order.
+
+ * `--color-output` / `-C` and `--monochrome-output` / `-M`:
+
+ By default, jq outputs colored JSON if writing to a
+ terminal. You can force it to produce color even if writing to
+ a pipe or a file using `-C`, and disable color with `-M`.
+
+ * `--tab`:
+
+ Use a tab for each indentation level instead of two spaces.
+
+ * `--indent n`:
+
+ Use the given number of spaces (no more than 7) for indentation.
+
* `--unbuffered`:
Flush the output after each JSON object is printed (useful if
you're piping a slow data source into jq and piping jq's
output elsewhere).
- * `--sort-keys` / `-S`:
-
- Output the fields of each object with the keys in sorted order.
+ * `--stream`:
- * `--raw-output` / `-r`:
+ Parse the input in streaming fashion, outputting arrays of path
+ and leaf values (scalars and empty arrays or empty objects).
+ For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
+ becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
- With this option, if the filter's result is a string then it
- will be written directly to standard output rather than being
- formatted as a JSON string with quotes. This can be useful for
- making jq filters talk to non-JSON-based systems.
+ This is useful for processing very large inputs. Use this in
+ conjunction with filtering and the `reduce` and `foreach` syntax
+ to reduce large inputs incrementally.
- * `--join-output` / `-j`:
+ * `--seq`:
- Like `-r` but jq won't print a newline after each output.
+ Use the `application/json-seq` MIME type scheme for separating
+ JSON texts in jq's input and output. This means that an ASCII
+ RS (record separator) character is printed before each value on
+ output and an ASCII LF (line feed) is printed after every
+ output. Input JSON texts that fail to parse are ignored (but
+ warned about), discarding all subsequent input until the next
+ RS. This mode also parses the output of jq without the `--seq`
+ option.
* `-f filename` / `--from-file filename`:
Read filter from the file rather than from a command line, like
awk's -f option. You can also use '#' to make comments.
- * `-Ldirectory` / `-L directory`:
+ * `-L directory`:
Prepend `directory` to the search list for modules. If this
option is used then no builtin search list is used. See the
section on modules below.
- * `-e` / `--exit-status`:
-
- Sets the exit status of jq to 0 if the last output value was
- neither `false` nor `null`, 1 if the last output value was
- either `false` or `null`, or 4 if no valid result was ever
- produced. Normally jq exits with 2 if there was any usage
- problem or system error, 3 if there was a jq program compile
- error, or 0 if the jq program ran.
-
* `--arg name value`:
This option passes a value to the jq program as a predefined
@@ -227,7 +214,7 @@ sections:
This option reads all the JSON texts in the named file and binds
an array of the parsed JSON values to the given global variable.
- If you run jq with `--argfile foo bar`, then `$foo` is available
+ If you run jq with `--slurpfile foo bar`, then `$foo` is available
in the program and has an array whose elements correspond to the
texts in the file named `bar`.
@@ -239,6 +226,23 @@ sections:
one text, then that is used, else an array of texts is used as
in `--slurpfile`.)
+ * `--exit-status` / `-e`:
+
+ Sets the exit status of jq to 0 if the last output value was
+ neither `false` nor `null`, 1 if the last output value was
+ either `false` or `null`, or 4 if no valid result was ever
+ produced. Normally jq exits with 2 if there was any usage
+ problem or system error, 3 if there was a jq program compile
+ error, or 0 if the jq program ran.
+
+ * `--version` / `-V`:
+
+ Output the jq version and exit with zero.
+
+ * `--help` / `-h`:
+
+ Output the jq help and exit with zero.
+
* `--run-tests [filename]`:
Runs the tests in the given file or standard input. This must
@@ -247,7 +251,7 @@ sections:
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,
+ only `%%FAIL`, then a line containing the program to compile,
then a line containing an error message to compare to the
actual.
diff --git a/docs/content/manual/v1.6/manual.yml b/docs/content/manual/v1.6/manual.yml
index a33eff7a..00ae468b 100644
--- a/docs/content/manual/v1.6/manual.yml
+++ b/docs/content/manual/v1.6/manual.yml
@@ -103,50 +103,24 @@ sections:
You can affect how jq reads and writes its input and output
using some command-line options:
- * `--version`/`-V`:
+ * `--null-input` / `-n`:
- Output the jq version and exit with zero.
-
- * `--seq`:
-
- Use the `application/json-seq` MIME type scheme for separating
- JSON texts in jq's input and output. This means that an ASCII
- RS (record separator) character is printed before each value on
- output and an ASCII LF (line feed) is printed after every
- output. Input JSON texts that fail to parse are ignored (but
- warned about), discarding all subsequent input until the next
- RS. This mode also parses the output of jq without the `--seq`
- option.
-
- * `--stream`:
-
- Parse the input in streaming fashion, outputting arrays of path
- and leaf values (scalars and empty arrays or empty objects).
- For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
- becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
-
- This is useful for processing very large inputs. Use this in
- conjunction with filtering and the `reduce` and `foreach` syntax
- to reduce large inputs incrementally.
-
- * `--slurp`/`-s`:
-
- Instead of running the filter for each JSON object in the
- input, read the entire input stream into a large array and run
- the filter just once.
+ Don't read any input at all. Instead, the filter is run once
+ using `null` as the input. This is useful when using jq as a
+ simple calculator or to construct JSON data from scratch.
- * `--raw-input`/`-R`:
+ * `--raw-input` / `-R`:
Don't parse the input as JSON. Instead, each line of text is
passed to the filter as a string. If combined with `--slurp`,
then the entire input is passed to the filter as a single long
string.
- * `--null-input`/`-n`:
+ * `--slurp` / `-s`:
- Don't read any input at all! Instead, the filter is run once
- using `null` as the input. This is useful when using jq as a
- simple calculator or to construct JSON data from scratch.
+ Instead of running the filter for each JSON object in the
+ input, read the entire input stream into a large array and run
+ the filter just once.
* `--compact-output` / `-c`:
@@ -154,13 +128,28 @@ sections:
will result in more compact output by instead putting each
JSON object on a single line.
- * `--tab`:
+ * `--raw-output` / `-r`:
- Use a tab for each indentation level instead of two spaces.
+ With this option, if the filter's result is a string then it
+ will be written directly to standard output rather than being
+ formatted as a JSON string with quotes. This can be useful for
+ making jq filters talk to non-JSON-based systems.
- * `--indent n`:
+ * `--join-output` / `-j`:
- Use the given number of spaces (no more than 7) for indentation.
+ Like `-r` but jq won't print a newline after each output.
+
+ * `--ascii-output` / `-a`:
+
+ jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
+ if the input specified them as escape sequences (like
+ "\u03bc"). Using this option, you can force jq to produce pure
+ ASCII output with every non-ASCII character replaced with the
+ equivalent escape sequence.
+
+ * `--sort-keys` / `-S`:
+
+ Output the fields of each object with the keys in sorted order.
* `--color-output` / `-C` and `--monochrome-output` / `-M`:
@@ -171,13 +160,13 @@ sections:
Colors can be configured with the `JQ_COLORS` environment
variable (see below).
- * `--ascii-output` / `-a`:
+ * `--tab`:
- jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
- if the input specified them as escape sequences (like
- "\u03bc"). Using this option, you can force jq to produce pure
- ASCII output with every non-ASCII character replaced with the
- equivalent escape sequence.
+ Use a tab for each indentation level instead of two spaces.
+
+ * `--indent n`:
+
+ Use the given number of spaces (no more than 7) for indentation.
* `--unbuffered`:
@@ -185,44 +174,39 @@ sections:
you're piping a slow data source into jq and piping jq's
output elsewhere).
- * `--sort-keys` / `-S`:
-
- Output the fields of each object with the keys in sorted order.
+ * `--stream`:
- * `--raw-output` / `-r`:
+ Parse the input in streaming fashion, outputting arrays of path
+ and leaf values (scalars and empty arrays or empty objects).
+ For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
+ becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
- With this option, if the filter's result is a string then it
- will be written directly to standard output rather than being
- formatted as a JSON string with quotes. This can be useful for
- making jq filters talk to non-JSON-based systems.
+ This is useful for processing very large inputs. Use this in
+ conjunction with filtering and the `reduce` and `foreach` syntax
+ to reduce large inputs incrementally.
- * `--join-output` / `-j`:
+ * `--seq`:
- Like `-r` but jq won't print a newline after each output.
+ Use the `application/json-seq` MIME type scheme for separating
+ JSON texts in jq's input and output. This means that an ASCII
+ RS (record separator) character is printed before each value on
+ output and an ASCII LF (line feed) is printed after every
+ output. Input JSON texts that fail to parse are ignored (but
+ warned about), discarding all subsequent input until the next
+ RS. This mode also parses the output of jq without the `--seq`
+ option.
* `-f filename` / `--from-file filename`:
Read filter from the file rather than from a command line, like
awk's -f option. You can also use '#' to make comments.
- * `-Ldirectory` / `-L directory`:
+ * `-L directory`:
Prepend `directory` to the search list for modules. If this
option is used then no builtin search list is used. See the
section on modules below.
- * `-e` / `--exit-status`:
-
- Sets the exit status of jq to 0 if the last output value was
- neither `false` nor `null`, 1 if the last output value was
- either `false` or `null`, or 4 if no valid result was ever
- produced. Normally jq exits with 2 if there was any usage
- problem or system error, 3 if there was a jq program compile
- error, or 0 if the jq program ran.
-
- Another way to set the exit status is with the `halt_error`
- builtin function.
-
* `--arg name value`:
This option passes a value to the jq program as a predefined
@@ -273,6 +257,26 @@ sections:
Remaining arguments are positional JSON text arguments. These
are available to the jq program as `$ARGS.positional[]`.
+ * `--exit-status` / `-e`:
+
+ Sets the exit status of jq to 0 if the last output value was
+ neither `false` nor `null`, 1 if the last output value was
+ either `false` or `null`, or 4 if no valid result was ever
+ produced. Normally jq exits with 2 if there was any usage
+ problem or system error, 3 if there was a jq program compile
+ error, or 0 if the jq program ran.
+
+ Another way to set the exit status is with the `halt_error`
+ builtin function.
+
+ * `--version` / `-V`:
+
+ Output the jq version and exit with zero.
+
+ * `--help` / `-h`:
+
+ Output the jq help and exit with zero.
+
* `--run-tests [filename]`:
Runs the tests in the given file or standard input. This must
@@ -281,7 +285,7 @@ sections:
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 con