diff options
author | René Scharfe <l.s.r@web.de> | 2015-11-17 11:25:53 +0100 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2015-11-20 08:02:07 -0500 |
commit | 4441549995d796084526a5ed6a6c9add7af6c665 (patch) | |
tree | c4e15a7b293a4a61d398d753412afd3240af69e1 /builtin | |
parent | parse-options: allow -h as a short option (diff) | |
download | tgif-4441549995d796084526a5ed6a6c9add7af6c665.tar.xz |
grep: stop using PARSE_OPT_NO_INTERNAL_HELP
The flag PARSE_OPT_NO_INTERNAL_HELP is set to allow overriding the
option -h, except when it's the only one given. This is the default
behavior now, so remove the flag and the hand-rolled --help-all
handling. The internal --help-all handler now actually shows hidden
options, i.e. --debug in this case.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/grep.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index d04f4400d9..749e346f49 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -612,11 +612,6 @@ static int pattern_callback(const struct option *opt, const char *arg, return 0; } -static int help_callback(const struct option *opt, const char *arg, int unset) -{ - return -1; -} - int cmd_grep(int argc, const char **argv, const char *prefix) { int hit = 0; @@ -738,18 +733,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix) PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager }, OPT_BOOL(0, "ext-grep", &external_grep_allowed__ignored, N_("allow calling of grep(1) (ignored by this build)")), - { OPTION_CALLBACK, 0, "help-all", NULL, NULL, N_("show usage"), - PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, help_callback }, OPT_END() }; - /* - * 'git grep -h', unlike 'git grep -h <pattern>', is a request - * to show usage information and exit. - */ - if (argc == 2 && !strcmp(argv[1], "-h")) - usage_with_options(grep_usage, options); - init_grep_defaults(); git_config(grep_cmd_config, NULL); grep_init(&opt, prefix); @@ -766,8 +752,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) */ argc = parse_options(argc, argv, prefix, options, grep_usage, PARSE_OPT_KEEP_DASHDASH | - PARSE_OPT_STOP_AT_NON_OPTION | - PARSE_OPT_NO_INTERNAL_HELP); + PARSE_OPT_STOP_AT_NON_OPTION); grep_commit_pattern_type(pattern_type_arg, &opt); if (use_index && !startup_info->have_repository) |