1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-06 19:21:43 +00:00

Feature: Highlight non-printable characters

Adds a new `-A`/`--show-all` option (in analogy to GNU Linux `cat`s option) that
highlights non-printable characters like space, tab or newline.

This works in two steps:
- **Preprocessing**: replace space by `•`, replace tab by `├──┤`, replace
newline by `␤`, etc.
- **Highlighting**: Use a newly written Sublime syntax to highlight
these special symbols.

Note: This feature is not technically a drop-in replacement for GNU `cat`s
`--show-all` but it has the same purpose.
This commit is contained in:
sharkdp
2018-11-01 13:02:29 +01:00
committed by David Peter
parent cbed338c3a
commit ecd862d9ff
6 changed files with 108 additions and 5 deletions
+12
View File
@@ -158,6 +158,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
'--style=numbers'",
),
)
.arg(
Arg::with_name("show-all")
.long("show-all")
.alias("show-nonprintable")
.short("A")
.conflicts_with("language")
.help("Show non-printable characters (space, tab, newline, ..).")
.long_help(
"Show non-printable characters like space, tab or newline. \
Use '--tabs' to control the width of the tab-placeholders.",
),
)
.arg(
Arg::with_name("line-range")
.long("line-range")