mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-30 10:06:12 +00:00
feat: implement -b / --number-nonblank for cat -b compatibility
Adds a `-b` / `--number-nonblank` flag that numbers only non-blank lines. Blank lines (those containing only the line terminator) are printed without a number and don't advance the counter, matching `cat -b` behaviour. - `-b` implies `--style=numbers` (same as `-n`), but only counts non-blank lines - `-b` takes precedence over `-n`: both `-bn` and `-nb` behave like `-b` - `-bp` disables numbering (plain mode wins) - Works with files, stdin, and piped output (like `-n`) Closes #3856.
This commit is contained in:
1 parent
78951393e2
commit
061fb216cb
10 files changed
+168
-6
No files matched your search
@@ -33,6 +33,8 @@ Options:
|
||||
Truncate all lines longer than screen width. Alias for '--wrap=never'.
|
||||
-n, --number
|
||||
Show line numbers (alias for '--style=numbers').
|
||||
-b, --number-nonblank
|
||||
Show line numbers for non-blank lines only (alias for '--style=numbers').
|
||||
--color <when>
|
||||
When to use colors (*auto*, never, always).
|
||||
--italic-text <when>
|
||||
|
||||
Reference in new issue
Block a user