summaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
authorRoman Proskuryakov <humbug@deeptown.org>2017-03-28 21:14:32 +0300
committerAndrew Gallant <jamslam@gmail.com>2017-04-09 08:47:35 -0400
commit90a11dec5e5765af560d343e879869a60363ef54 (patch)
tree150d2e7b22d10d3e35e8f96d5dacebbdf215c46f /src/args.rs
parent9456d95e8f8f170593a68675ca27ee7010ed045a (diff)
Add `-o/--only-matching` flag.
Currently, the `--only-matching` flag conflicts with the `--replace` flag. In the future, this restriction may be relaxed. Fixes #34
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs
index 90e5a9a4..34f38792 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -65,6 +65,7 @@ pub struct Args {
no_ignore_vcs: bool,
no_messages: bool,
null: bool,
+ only_matching: bool,
path_separator: Option<u8>,
quiet: bool,
quiet_matched: QuietMatched,
@@ -141,6 +142,7 @@ impl Args {
.heading(self.heading)
.line_per_match(self.line_per_match)
.null(self.null)
+ .only_matching(self.only_matching)
.path_separator(self.path_separator)
.with_filename(self.with_filename)
.max_columns(self.max_columns);
@@ -345,6 +347,7 @@ impl<'a> ArgMatches<'a> {
no_ignore_vcs: self.no_ignore_vcs(),
no_messages: self.is_present("no-messages"),
null: self.is_present("null"),
+ only_matching: self.is_present("only-matching"),
path_separator: try!(self.path_separator()),
quiet: quiet,
quiet_matched: QuietMatched::new(quiet),