on master help sign in
Grammar touch-ups, more descriptive error message for invalid line

ranges

commit5ef1c6cce2bbe2065367b239c2db0547340ddea7 authorLiam Kalir <liamkalir9595@gmail.com> dateSun 26 Jan 2020, 19:19 (7 years ago) parent93881d9
2 files changed+4−4
src/bin/bat/clap_app.rs+3−3 src/line_range.rs+1−1
src/bin/bat/clap_app.rs+3−3
@@ -87,10 +87,10 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
8787 .long_help(
8888 "Highlight the specified line ranges with a different background color \
8989 For example:\n \
90+ '--highlight-line 40' highlights line 40\n \
9091 '--highlight-line 30:40' highlights lines 30 to 40\n \
9192 '--highlight-line :40' highlights lines 1 to 40\n \
92− '--highlight-line 40:' highlights lines 40 to the end of the file\n \
93− '--highlight-line 40' highlights only line 40",
93+ '--highlight-line 40:' highlights lines 40 to the end of the file"
9494 ),
9595 )
9696 .arg(
@@ -334,7 +334,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
334334 '--line-range 30:40' prints lines 30 to 40\n \
335335 '--line-range :40' prints lines 1 to 40\n \
336336 '--line-range 40:' prints lines 40 to the end of the file\n \
337− '--line-range 40' prints only line 40",
337+ '--line-range 40' only prints line 40",
338338 ),
339339 )
340340 .arg(
src/line_range.rs+1−1
@@ -41,7 +41,7 @@ impl LineRange {
4141 new_range.upper = line_numbers[1].parse()?;
4242 Ok(new_range)
4343 },
44− _ => Err("expected at most single ':' character".into()),
44+ _ => Err("Line range contained more than one ':' character. Expected format: 'N' or 'N:M'".into()),
4545 }
4646 }
4747