search: add a --count-matches flag

This commit introduces a new flag, --count-matches, which will cause
ripgrep to report a total count of all matches instead of a count of
total lines matched.

Closes #566, Closes #814
This commit is contained in:
Balaji Sivaraman
2018-02-20 21:03:07 +05:30
committed by Andrew Gallant
parent 96f73293c0
commit 27fc9f2fd3
7 changed files with 147 additions and 7 deletions

View File

@@ -27,7 +27,8 @@ _rg() {
'(-A -B -C --after-context --before-context --context)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
'(-b --byte-offset)'{-b,--byte-offset}'[print the 0-based byte offset for each matching line]'
'--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
'(-c --count --passthrough --passthru)'{-c,--count}'[only show count of matches for each file]'
'(-c --count --count-matches --passthrough --passthru)'{-c,--count}'[only show count of matching lines for each file]'
'(--count-matches -c --count --passthrough --passthru)--count-matches[only show count of individual matches for each file]'
'--debug[show debug messages]'
'--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size'
'(-E --encoding)'{-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'