These flags are passed to pcre2grep(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
# Defaults:
+A='';
+B='';
+C='';
c='no';
h='-H';
i='';
grepc_parse_cmd()
{
- while getopts "chiklt:" opt; do
+ while getopts "A:B:C:chiklt:" opt; do
case "$opt" in
+ A)
+ A="-A$OPTARG";
+ ;;
+ B)
+ B="-B$OPTARG";
+ ;;
+ C)
+ C="-C$OPTARG";
+ ;;
c)
c='yes';
;;
grepc_patterns "$identifier" >"$patterns";
+ opts="$opts $A";
+ opts="$opts $B";
+ opts="$opts $C";
opts="$opts $h";
opts="$opts $i";
opts="$opts $l";
.RE
.SH OPTIONS
.TP
+.BI \-A \~n
+Print
+.I n
+lines of trailing context after a match.
+.TP
+.BI \-B \~n
+Print
+.I n
+lines of leading context before a match.
+.TP
+.BI \-C \~n
+Print
+.I n
+lines of context surrounding a match.
+.TP
.B \-c
Surround the matched strings
with escape sequences to display them in color on the terminal.