1
0
mirror of https://github.com/sharkdp/bat.git synced 2026-02-08 08:42:08 +00:00

fix: allow hyphen values to -r/--line-range

via #2944
This commit is contained in:
Louis Maddox
2025-10-19 19:23:57 +01:00
committed by Louis Maddox
parent 20db989fb1
commit 52a792d46f
4 changed files with 17 additions and 1 deletions

View File

@@ -519,6 +519,7 @@ pub fn build_app(interactive_output: bool) -> Command {
.short('r')
.action(ArgAction::Append)
.value_name("N:M")
.allow_hyphen_values(true)
.help("Only print the lines from N to M.")
.long_help(
"Only print the specified range of lines for each file. \
@@ -527,6 +528,7 @@ pub fn build_app(interactive_output: bool) -> Command {
'--line-range :40' prints lines 1 to 40\n \
'--line-range 40:' prints lines 40 to the end of the file\n \
'--line-range 40' only prints line 40\n \
'--line-range -10:' prints the last 10 lines\n \
'--line-range 30:+10' prints lines 30 to 40\n \
'--line-range 35::5' prints lines 30 to 40 (line 35 with 5 lines of context)\n \
'--line-range 30:40:2' prints lines 28 to 42 (range 30-40 with 2 lines of context)",