colorize-output using regexes, refactor line colorization (#49)

This commit is contained in:
T. von Dein
2026-01-19 14:05:28 +01:00
parent 46fde289f5
commit 834892e302
11 changed files with 143 additions and 60 deletions

View File

@@ -20,6 +20,7 @@ SYNOPSIS
-F, --filter <field[!]=reg> Filter given field with regex, can be used multiple times
-T, --transpose-columns string Transpose the speficied columns (separated by ,)
-R, --regex-transposer </from/to/> Apply /search/replace/ regexp to fields given in -T
-K --regex-colorizer /from/color/ colorize pattern of output (color: fg[:bg])
-j, --json Read JSON input (must be array of hashes)
-I, --interactive Interactively filter and select rows
-g, --auto-headers Generate headers if there are none present in input
@@ -467,9 +468,20 @@ CONFIGURATION AND COLORS
lightGreen, lightMagenta, lightRed, lightWhite, lightYellow, magenta,
red, white, yellow
The Variables FG and BG are being used to highlight matches. The other
*FG and *BG variables are for colored table output (enabled with the
"-L" parameter).
but you may also use HTML color codes without the hash sign.
The Variables FG and BG are being used to highlight matching rows. The
other *FG and *BG variables are for colored table output (enabled with
the "-L" parameter).
You can also use the option "-K" to colorize particular patterns, not
whole lines. The option can be given multiple times and expects the
following parameter:
-K '/regex/foreground[:background]/
that is, background color is optional. This colorization will applied on
top of any previous colorizations, if any.
Colorization can be turned off completely either by setting the
parameter "-N" or the environment variable NO_COLOR to a true value.
@@ -531,6 +543,7 @@ Operational Flags:
-F, --filter <field[!]=reg> Filter given field with regex, can be used multiple times
-T, --transpose-columns string Transpose the speficied columns (separated by ,)
-R, --regex-transposer </from/to/> Apply /search/replace/ regexp to fields given in -T
-K --regex-colorizer /from/color/ colorize pattern of output (color: fg[:bg])
-j, --json Read JSON input (must be array of hashes)
-I, --interactive Interactively filter and select rows
-g, --auto-headers Generate headers if there are none present in input