summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-12-01 23:31:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-12-07 22:19:32 (GMT)
commitb57c68a69e028cc41eb01404dc4446a463c0e464 (patch)
tree99d40935f88471e16d0dd7f027000b5cd10d928d /parse-options.c
parentc1f4ec9ef45232d6dbdea4c417a9d41eb8ad7f4f (diff)
downloadgit-b57c68a69e028cc41eb01404dc4446a463c0e464.zip
git-b57c68a69e028cc41eb01404dc4446a463c0e464.tar.gz
git-b57c68a69e028cc41eb01404dc4446a463c0e464.tar.bz2
parse-options: never suppress arghelp if LITERAL_ARGHELP is set
The PARSE_OPT_LITERAL_ARGHELP flag allows a program to override the standard "<argument> for mandatory, [argument] for optional" markup in its help message. Extend it to override the usual "no text for disallowed", too (for the PARSE_OPT_NOARG | PARSE_OPT_LITERAL_ARGHELP case, which was previously meaningless), to be more intuitive. The motivation is to allow update-index to correctly advertise --cacheinfo <mode> <object> <path> add the specified entry to the index while abusing PARSE_OPT_NOARG to disallow the "sticked form" --cacheinfo=<mode> <object> <path> Noticed-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/parse-options.c b/parse-options.c
index 5780356..632c134 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -537,7 +537,8 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
if (opts->type == OPTION_NUMBER)
pos += fprintf(outfile, "-NUM");
- if (!(opts->flags & PARSE_OPT_NOARG))
+ if ((opts->flags & PARSE_OPT_LITERAL_ARGHELP) ||
+ !(opts->flags & PARSE_OPT_NOARG))
pos += usage_argh(opts, outfile);
if (pos <= USAGE_OPTS_WIDTH)