parse-options: make OPT_INTEGER's argh explicit
OPTION_INTEGER hardcodes its argh member to be "n", but the decision is hidden deep in usage_with_options_internal(). Make "n" the default argh for the OPT_INTEGER macro while leaving it undecided for the OPTION_INTEGER enum. This makes it less surprising to users that argh is "n" when using the OPT_INTEGER macro. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Reviewed-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
6096d75980
commit
e3a0ca8784
@ -503,19 +503,12 @@ int usage_with_options_internal(const char * const *usagestr,
|
||||
switch (opts->type) {
|
||||
case OPTION_ARGUMENT:
|
||||
break;
|
||||
case OPTION_INTEGER:
|
||||
if (opts->flags & PARSE_OPT_OPTARG)
|
||||
if (opts->long_name)
|
||||
pos += fprintf(stderr, "[=<n>]");
|
||||
else
|
||||
pos += fprintf(stderr, "[<n>]");
|
||||
else
|
||||
pos += fprintf(stderr, " <n>");
|
||||
break;
|
||||
case OPTION_CALLBACK:
|
||||
if (opts->flags & PARSE_OPT_NOARG)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case OPTION_INTEGER:
|
||||
/* FALLTHROUGH */
|
||||
case OPTION_FILENAME:
|
||||
/* FALLTHROUGH */
|
||||
case OPTION_STRING:
|
||||
|
Reference in New Issue
Block a user