parse-options: simplify usage argh handling
Simplify the argh printing by simply calling usage_argh() if the option can take an argument. Update macros defined in parse-options.h to set the PARSE_OPT_NOARG flag. The only other user of custom non-argument taking options is git-apply (in this case OPTION_BOOLEAN for deprecated options). Update it to set the PARSE_OPT_NOARG flag. Thanks to Ren辿 Scharfe for the suggestion and starter patch. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Reviewd-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
e3a0ca8784
commit
34aec9f573
@ -3277,9 +3277,11 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
|
||||
OPT_BOOLEAN(0, "stat", &diffstat,
|
||||
"instead of applying the patch, output diffstat for the input"),
|
||||
{ OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary,
|
||||
NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
|
||||
NULL, "old option, now no-op",
|
||||
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
|
||||
{ OPTION_BOOLEAN, 0, "binary", &binary,
|
||||
NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
|
||||
NULL, "old option, now no-op",
|
||||
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
|
||||
OPT_BOOLEAN(0, "numstat", &numstat,
|
||||
"shows number of added and deleted lines in decimal notation"),
|
||||
OPT_BOOLEAN(0, "summary", &summary,
|
||||
|
||||
Reference in New Issue
Block a user