From: Junio C Hamano Date: Sun, 23 Mar 2014 23:04:36 +0000 (-0700) Subject: parse-options: make sure argh string does not have SP or _ X-Git-Tag: v2.0.0-rc0~19^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6c2a0d45d4165dfd326bd7a28e66d9cedb8ae84;p=git parse-options: make sure argh string does not have SP or _ We encourage to spell an argument hint that consists of multiple words as a single-token separated with dashes. In order to help catching violations added by new callers of parse-options, make sure argh does not contain SP or _ when the code validates the option definitions. Signed-off-by: Junio C Hamano --- diff --git a/parse-options.c b/parse-options.c index a5fa0b8938..c81d3a0655 100644 --- a/parse-options.c +++ b/parse-options.c @@ -375,6 +375,9 @@ static void parse_options_check(const struct option *opts) default: ; /* ok. (usually accepts an argument) */ } + if (opts->argh && + strcspn(opts->argh, " _") != strlen(opts->argh)) + err |= optbug(opts, "multi-word argh should use dash to separate words"); } if (err) exit(128);