1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-22 16:53:19 +00:00

feat: add context support to line-range syntax

docs(long-help.txt): 📚 add examples for N::C and N:M:C context syntax
docs(clap_app.rs): 📚 update CLI help text with context syntax examples
feat(line_range.rs):  implement N::C and N:M:C parsing and add tests
This commit is contained in:
John Cavanaugh
2025-07-15 16:17:09 -07:00
parent 1ad294dcd3
commit 6c13a98f01
3 changed files with 77 additions and 2 deletions
+3 -1
View File
@@ -525,7 +525,9 @@ 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 30:+10' prints lines 30 to 40",
'--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)",
),
)
.arg(