summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2015-11-17 11:26:05 +0100
committerLibravatar Jeff King <peff@peff.net>2015-11-20 08:02:07 -0500
commit42fdf86e5f6ecf675e973e3e4a08952c8b1fd4c4 (patch)
tree13cf2f72a2b47554782c0b9f82243a14b2622479
parentgrep: stop using PARSE_OPT_NO_INTERNAL_HELP (diff)
downloadtgif-42fdf86e5f6ecf675e973e3e4a08952c8b1fd4c4.tar.xz
show-ref: 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. -h in this case. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net>
-rw-r--r--builtin/show-ref.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 264c392007..6d4e669002 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -161,11 +161,6 @@ static int exclude_existing_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;
-}
-
static const struct option show_ref_options[] = {
OPT_BOOL(0, "tags", &tags_only, N_("only show tags (can be combined with heads)")),
OPT_BOOL(0, "heads", &heads_only, N_("only show heads (can be combined with tags)")),
@@ -186,18 +181,13 @@ static const struct option show_ref_options[] = {
{ OPTION_CALLBACK, 0, "exclude-existing", &exclude_existing_arg,
N_("pattern"), N_("show refs from stdin that aren't in local repository"),
PARSE_OPT_OPTARG | PARSE_OPT_NONEG, exclude_existing_callback },
- { OPTION_CALLBACK, 0, "help-all", NULL, NULL, N_("show usage"),
- PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, help_callback },
OPT_END()
};
int cmd_show_ref(int argc, const char **argv, const char *prefix)
{
- if (argc == 2 && !strcmp(argv[1], "-h"))
- usage_with_options(show_ref_usage, show_ref_options);
-
argc = parse_options(argc, argv, prefix, show_ref_options,
- show_ref_usage, PARSE_OPT_NO_INTERNAL_HELP);
+ show_ref_usage, 0);
if (exclude_arg)
return exclude_existing(exclude_existing_arg);