From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
carlos.duclos@nokia.com, Pierre Habouzit <madcoder@madism.org>
Subject: [PATCH 3/4] parseopt: make usage optional
Date: Sun, 08 Mar 2009 19:16:58 +0100 [thread overview]
Message-ID: <49B40B9A.8080202@lsrfire.ath.cx> (raw)
In-Reply-To: <49B2C784.90800@lsrfire.ath.cx>
Allow usagestr to be NULL and don't display anything a help screen in
this case. This is useful to implement incremental parsers.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
parse-options.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index 8b21dea..51e804b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -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++);
--
1.6.2
next prev parent reply other threads:[~2009-03-08 18:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-05 10:07 What's in git.git (Mar 2009, #02; Thu, 05) Junio C Hamano
2009-03-07 19:14 ` René Scharfe
2009-03-08 18:12 ` [PATCH 1/4] parseopt: add PARSE_OPT_KEEP_UNKNOWN René Scharfe
2009-03-08 20:24 ` Junio C Hamano
2009-03-08 20:30 ` Junio C Hamano
2009-03-09 20:26 ` [PATCH 5/4] parseopt: document KEEP_ARGV0, KEEP_UNKNOWN, NO_INTERNAL_HELP René Scharfe
2009-03-09 20:57 ` [PATCH 6/4] parseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used together René Scharfe
2009-03-08 18:15 ` [PATCH 2/4] parseopt: add PARSE_OPT_NO_INTERNAL_HELP René Scharfe
2009-03-08 18:16 ` René Scharfe [this message]
2009-03-08 20:25 ` [PATCH 3/4] parseopt: make usage optional Junio C Hamano
2009-03-09 20:19 ` René Scharfe
2009-03-08 18:21 ` [PATCH 4/4] archive: use parseopt for local-only options René Scharfe
2009-03-08 20:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49B40B9A.8080202@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=carlos.duclos@nokia.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madcoder@madism.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.