What would you like to see?
Add cat-compatible -v, -e, and -t options.
Expected behavior:
-v / --show-nonprinting uses caret and M- notation for nonprinting bytes, except tabs and line feeds.
-e includes -v behavior and writes $ before each line feed.
-t includes -v behavior and writes tabs as ^I.
- Support files, standard input, multiple inputs, combined short options, and piped output.
These are grouped in one issue because -e and -t both include -v's nonprinting behavior.
For example:
$ printf 'a\tb\r\007\n' | bat -t
a^Ib^M^G
Why?
Commands written for cat currently fail when cat is replaced interactively with bat:
$ printf 'a\tb\n' | bat -v
error: unexpected argument '-v' found
I use cat=bat in an interactive shell, where commands copied from documentation or produced by shell tooling and agents can hit this incompatibility.
The missing options are noted in #134. #1749 was closed and discussed -v isn't a POSIX cat option (unlcear if that was exact reason for closure since it veered into discussion of -A flag).
Bat does implement selected non-POSIX cat options, including -n, -s (#2665), and -b (#3857); the latter two were added after #1749. This request wouldn't change default output or behavior for POSIX invocations.
Since #1749, bat has added a reusable caret renderer and expanded it to every ASCII control character plus DEL (#2443, #2712). This provides part of the machinery needed for -v, although tab and line-feed handling and GNU/uutils M- notation still require new work.
Implementation considerations
The options can share a mode controlling nonprinting bytes, line endings, and tabs. Bat's caret renderer already handles every ASCII control character, but compatibility still requires selectively preserving spaces, tabs, and line feeds and using GNU/uutils M- output for high-bit bytes instead of Unicode or hexadecimal escaping.
Suggested acceptance criteria
bat -v preserves spaces, tabs, and line feeds while showing other control bytes with caret notation and high-bit bytes with GNU/uutils M- notation.
bat -e adds $ before line feeds without replacing tabs.
bat -t writes tabs as ^I without adding end-of-line markers.
- The options work with files, standard input, multiple inputs, combined short options, and piped output.
- Existing binary handling, styling, decorations, and default output remain unchanged.
What would you like to see?
Add cat-compatible
-v,-e, and-toptions.Expected behavior:
-v/--show-nonprintinguses caret andM-notation for nonprinting bytes, except tabs and line feeds.-eincludes-vbehavior and writes$before each line feed.-tincludes-vbehavior and writes tabs as^I.These are grouped in one issue because
-eand-tboth include-v's nonprinting behavior.For example:
Why?
Commands written for cat currently fail when
catis replaced interactively with bat:I use
cat=batin an interactive shell, where commands copied from documentation or produced by shell tooling and agents can hit this incompatibility.The missing options are noted in #134. #1749 was closed and discussed
-visn't a POSIXcatoption (unlcear if that was exact reason for closure since it veered into discussion of -A flag).Bat does implement selected non-POSIX
catoptions, including-n,-s(#2665), and-b(#3857); the latter two were added after #1749. This request wouldn't change default output or behavior for POSIX invocations.Since #1749, bat has added a reusable caret renderer and expanded it to every ASCII control character plus DEL (#2443, #2712). This provides part of the machinery needed for -v, although tab and line-feed handling and GNU/uutils M- notation still require new work.
Implementation considerations
The options can share a mode controlling nonprinting bytes, line endings, and tabs. Bat's caret renderer already handles every ASCII control character, but compatibility still requires selectively preserving spaces, tabs, and line feeds and using GNU/uutils
M-output for high-bit bytes instead of Unicode or hexadecimal escaping.Suggested acceptance criteria
bat -vpreserves spaces, tabs, and line feeds while showing other control bytes with caret notation and high-bit bytes with GNU/uutilsM-notation.bat -eadds$before line feeds without replacing tabs.bat -twrites tabs as^Iwithout adding end-of-line markers.