search: add -b/--byte-offset flag

This commit adds support for printing 0-based byte offset before each
line. We handle corner cases such as `-o/--only-matching` and
`-C/--context` as well.

Closes #812
This commit is contained in:
Balaji Sivaraman
2018-02-21 22:16:45 +05:30
committed by Andrew Gallant
parent 91d0756f62
commit b006943c01
8 changed files with 176 additions and 17 deletions

View File

@@ -25,6 +25,7 @@ _rg() {
'*--colors=[specify color settings and styles]: :->colorspec'
'--column[show column numbers]'
'(-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]'
'--debug[show debug messages]'