提交 49b61802 编写于 作者: R René Scharfe 提交者: Junio C Hamano

parseopt: make usage optional

Allow usagestr to be NULL and don't display any help screen in
this case.  This is useful to implement incremental parsers.
Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b92891f9
......@@ -364,6 +364,9 @@ int parse_options(int argc, const char **argv, const struct option *options,
int usage_with_options_internal(const char * const *usagestr,
const struct option *opts, int full)
{
if (!usagestr)
return PARSE_OPT_HELP;
fprintf(stderr, "usage: %s\n", *usagestr++);
while (*usagestr && **usagestr)
fprintf(stderr, " or: %s\n", *usagestr++);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册