manual.yml (jq-1.5) | : | manual.yml (jq-1.6) | ||
---|---|---|---|---|
skipping to change at line 110 | skipping to change at line 110 | |||
Don't read any input at all! Instead, the filter is run 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 | using `null` as the input. This is useful when using jq as a | |||
simple calculator or to construct JSON data from scratch. | simple calculator or to construct JSON data from scratch. | |||
* `--compact-output` / `-c`: | * `--compact-output` / `-c`: | |||
By default, jq pretty-prints JSON output. Using this option | By default, jq pretty-prints JSON output. Using this option | |||
will result in more compact output by instead putting each | will result in more compact output by instead putting each | |||
JSON object on a single line. | JSON object on a single line. | |||
* `--colour-output` / `-C` and `--monochrome-output` / `-M`: | * `--color-output` / `-C` and `--monochrome-output` / `-M`: | |||
By default, jq outputs colored JSON if writing to a | By default, jq outputs colored JSON if writing to a | |||
terminal. You can force it to produce color even if writing to | terminal. You can force it to produce color even if writing to | |||
a pipe or a file using `-C`, and disable color with `-M`. | a pipe or a file using `-C`, and disable color with `-M`. | |||
* `--ascii-output` / `-a`: | * `--ascii-output` / `-a`: | |||
jq usually outputs non-ASCII Unicode codepoints as UTF-8, even | jq usually outputs non-ASCII Unicode codepoints as UTF-8, even | |||
if the input specified them as escape sequences (like | if the input specified them as escape sequences (like | |||
"\u03bc"). Using this option, you can force jq to produce pure | "\u03bc"). Using this option, you can force jq to produce pure | |||
skipping to change at line 914 | skipping to change at line 914 | |||
as `C` otherwise. | as `C` otherwise. | |||
Checking for false or null is a simpler notion of | Checking for false or null is a simpler notion of | |||
"truthiness" than is found in Javascript or Python, but it | "truthiness" than is found in Javascript or Python, but it | |||
means that you'll sometimes have to be more explicit about | means that you'll sometimes have to be more explicit about | |||
the condition you want: you can't test whether, e.g. a | the condition you want: you can't test whether, e.g. a | |||
string is empty using `if .name then A else B end`, you'll | string is empty using `if .name then A else B end`, you'll | |||
need something more like `if (.name | count) > 0 then A else | need something more like `if (.name | count) > 0 then A else | |||
B end` instead. | B end` instead. | |||
If the condition A produces multiple results, it is | If the condition `A` produces multiple results, then `B` is evaluated | |||
considered "true" if any of those results is not false or | once for each result that is not false or null, and `C` is evaluated | |||
null. If it produces zero results, it's considered false. | once for each false or null. | |||
More cases can be added to an if using `elif A then B` syntax. | More cases can be added to an if using `elif A then B` syntax. | |||
examples: | examples: | |||
- program: |- | - program: |- | |||
if . == 0 then | if . == 0 then | |||
"zero" | "zero" | |||
elif . == 1 then | elif . == 1 then | |||
"one" | "one" | |||
else | else | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |