summaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/args.rs b/src/args.rs
index 309f5db8..a5e13415 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -747,10 +747,16 @@ impl<'a> ArgMatches<'a> {
let count = self.is_present("count");
let count_matches = self.is_present("count-matches");
let invert_matches = self.is_present("invert-match");
+ let only_matching = self.is_present("only-matching");
if count_matches && invert_matches {
- return (true, false);
+ // Treat `-v --count-matches` as `-v -c`.
+ (true, false)
+ } else if count && only_matching {
+ // Treat `-c --only-matching` as `--count-matches`.
+ (false, true)
+ } else {
+ (count, count_matches)
}
- (count, count_matches)
}
/// Returns the user's color choice based on command line parameters and