summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-06-23 01:39:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-06-23 01:39:37 (GMT)
commit0bd64f82ba38013799d1d999de5fc3c079bd8014 (patch)
treeb82d106611a32e50f74851dccf9c4f0ce65a5d1a /parse-options.c
parent9523298c95467e014daf5ed108cfcbe75a0d918d (diff)
parent010a2dacc1acf3305e399ef1eb2e620110b95d5e (diff)
downloadgit-0bd64f82ba38013799d1d999de5fc3c079bd8014.zip
git-0bd64f82ba38013799d1d999de5fc3c079bd8014.tar.gz
git-0bd64f82ba38013799d1d999de5fc3c079bd8014.tar.bz2
Merge branch 'maint'
* maint: Extend parse-options test suite api-parse-options.txt: Introduce documentation for parse options API parse-options.c: fix documentation syntax of optional arguments api-builtin.txt: update and fix typo
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/parse-options.c b/parse-options.c
index 8071711..b8bde2b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -348,7 +348,10 @@ void usage_with_options_internal(const char * const *usagestr,
break;
case OPTION_INTEGER:
if (opts->flags & PARSE_OPT_OPTARG)
- pos += fprintf(stderr, "[<n>]");
+ if (opts->long_name)
+ pos += fprintf(stderr, "[=<n>]");
+ else
+ pos += fprintf(stderr, "[<n>]");
else
pos += fprintf(stderr, " <n>");
break;
@@ -359,12 +362,18 @@ void usage_with_options_internal(const char * const *usagestr,
case OPTION_STRING:
if (opts->argh) {
if (opts->flags & PARSE_OPT_OPTARG)
- pos += fprintf(stderr, " [<%s>]", opts->argh);
+ if (opts->long_name)
+ pos += fprintf(stderr, "[=<%s>]", opts->argh);
+ else
+ pos += fprintf(stderr, "[<%s>]", opts->argh);
else
pos += fprintf(stderr, " <%s>", opts->argh);
} else {
if (opts->flags & PARSE_OPT_OPTARG)
- pos += fprintf(stderr, " [...]");
+ if (opts->long_name)
+ pos += fprintf(stderr, "[=...]");
+ else
+ pos += fprintf(stderr, "[...]");
else
pos += fprintf(stderr, " ...");
}