Skip to content

Commit b6c2a0d

Browse files
committed
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 <[email protected]>
1 parent ec160ae commit b6c2a0d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

parse-options.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ static void parse_options_check(const struct option *opts)
375375
default:
376376
; /* ok. (usually accepts an argument) */
377377
}
378+
if (opts->argh &&
379+
strcspn(opts->argh, " _") != strlen(opts->argh))
380+
err |= optbug(opts, "multi-word argh should use dash to separate words");
378381
}
379382
if (err)
380383
exit(128);

0 commit comments

Comments
 (0)