summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1f4ec9)
raw | patch | inline | side by side (parent: c1f4ec9)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Wed, 1 Dec 2010 23:31:36 +0000 (17:31 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 7 Dec 2010 22:19:32 +0000 (14:19 -0800) |
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>
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>
parse-options.c | patch | blob | history |
diff --git a/parse-options.c b/parse-options.c
index 578035671a8369c008ac27779faf34c1ab39eeec..632c1346c6bc6fd17a516b82771ba607961d3e4f 100644 (file)
--- a/parse-options.c
+++ b/parse-options.c
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)