Skip to content
Permalink
Browse files

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 <gitster@pobox.com>
  • Loading branch information...
gitster committed Mar 23, 2014
1 parent ec160ae commit b6c2a0d45d4165dfd326bd7a28e66d9cedb8ae84
Showing with 3 additions and 0 deletions.
  1. +3 −0 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);

0 comments on commit b6c2a0d

Please sign in to comment.
You can’t perform that action at this time.