summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index bcfbe5be5b..3ce574a605 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -983,9 +983,9 @@ int cmd_grep(int argc,
OPT_CALLBACK('C', "context", &opt, N_("n"),
N_("show <n> context lines before and after matches"),
context_callback),
- OPT_INTEGER('B', "before-context", &opt.pre_context,
+ OPT_UNSIGNED('B', "before-context", &opt.pre_context,
N_("show <n> context lines before matches")),
- OPT_INTEGER('A', "after-context", &opt.post_context,
+ OPT_UNSIGNED('A', "after-context", &opt.post_context,
N_("show <n> context lines after matches")),
OPT_INTEGER(0, "threads", &num_threads,
N_("use <n> worker threads")),
@@ -1017,10 +1017,16 @@ int cmd_grep(int argc,
OPT_BOOL(0, "all-match", &opt.all_match,
N_("show only matches from files that match all patterns")),
OPT_GROUP(""),
- { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager,
- N_("pager"), N_("show matching files in the pager"),
- PARSE_OPT_OPTARG | PARSE_OPT_NOCOMPLETE,
- NULL, (intptr_t)default_pager },
+ {
+ .type = OPTION_STRING,
+ .short_name = 'O',
+ .long_name = "open-files-in-pager",
+ .value = &show_in_pager,
+ .argh = N_("pager"),
+ .help = N_("show matching files in the pager"),
+ .flags = PARSE_OPT_OPTARG | PARSE_OPT_NOCOMPLETE,
+ .defval = (intptr_t)default_pager,
+ },
OPT_BOOL_F(0, "ext-grep", &external_grep_allowed__ignored,
N_("allow calling of grep(1) (ignored by this build)"),
PARSE_OPT_NOCOMPLETE),