Commit graph

6 commits

Author SHA1 Message Date
Kynan Ware
48951aca01 Fix invalid ANSI SGR escape code in JSON and diff colorization
Replace `1;38` with `1;37` (bold white) in the delimiter/header
color constant. SGR parameter 38 is the extended foreground color
prefix and requires sub-parameters (e.g. `38;5;n` or `38;2;r;g;b`),
so using it bare produces an invalid escape sequence. Most terminals
silently ignore the malformed parameter, masking the bug.

Fixes cli/cli#12683

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 17:52:01 -07:00
Heath Stewart
e83e049306
Wrap JSON arrays, objects in array with --slurp
Effectively copies `jq --slurp` since `--jq` already uses the same grammar.
2024-04-04 01:26:05 -07:00
Mislav Marohnić
f34fc61a9a
api: avoid HTML-escaping JSON output
json.Marshal does HTML-escaping by default, which is what we don't want since we're printing to the terminal instead of embedding this JSON into a HTML document.
2022-07-25 13:10:44 +02:00
Mislav Marohnić
fddc888a69 Fix "null" display in colored JSON output
"null" was previously rendered in "bright black", an ANSI color that is
not guaranteed to be visible at all depending on the terminal. Switch
the color to cyan to ensure that "null" is visible.
2021-05-12 16:56:52 +02:00
Mislav Marohnić
771cd5991c Add tests for jsoncolor 2020-06-08 16:05:00 +02:00
Mislav Marohnić
62549465a0 Display JSON in indented, colored format in api output 2020-06-05 17:43:07 +02:00