summaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
authorBalaji Sivaraman <balaji@balajisivaraman.com>2018-01-01 19:30:31 +0530
committerAndrew Gallant <jamslam@gmail.com>2018-01-01 09:00:31 -0500
commitba1023e1e45d7bd6edffa43d06c9613d3b84de8f (patch)
tree4fee4b0b3ef368344713e5fcac8e75593337d543 /src/args.rs
parent5e73075ef5300fdec03f6c4685750788108b00f4 (diff)
printer: add support for line number alignment
Closes #544
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs
index 106762c4..f2c9de44 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -54,6 +54,7 @@ pub struct Args {
invert_match: bool,
line_number: bool,
line_per_match: bool,
+ line_number_width: Option<usize>,
max_columns: Option<usize>,
max_count: Option<u64>,
max_filesize: Option<u64>,
@@ -144,7 +145,8 @@ impl Args {
.only_matching(self.only_matching)
.path_separator(self.path_separator)
.with_filename(self.with_filename)
- .max_columns(self.max_columns);
+ .max_columns(self.max_columns)
+ .line_number_width(self.line_number_width);
if let Some(ref rep) = self.replace {
p = p.replace(rep.clone());
}
@@ -336,6 +338,7 @@ impl<'a> ArgMatches<'a> {
ignore_files: self.ignore_files(),
invert_match: self.is_present("invert-match"),
line_number: line_number,
+ line_number_width: try!(self.usize_of("line-number-width")),
line_per_match: self.is_present("vimgrep"),
max_columns: try!(self.usize_of("max-columns")),
max_count: try!(self.usize_of("max-count")).map(|max| max as u64),