git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] parse-options: allow to define hidden synonym options
@ 2007-11-19  6:09 Junio C Hamano
  2007-11-19  8:04 ` [PATCH Illustration] branch --contains=<commit> Junio C Hamano
  2007-11-19  9:22 ` [PATCH/RFC] parse-options: allow to define hidden synonym options Pierre Habouzit
  0 siblings, 2 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-11-19  6:09 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: git

By setting the help member to NULL, you can implement an option
that is not shown in the "git-cmd -h" help output.  This is
useful to support backward compatible synonyms without
cluttering the help text.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 parse-options.c |    2 ++
 parse-options.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index d3e608a..1ee2c81 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -284,6 +284,8 @@ void usage_with_options(const char * const *usagestr,
 			if (*opts->help)
 				fprintf(stderr, "%s\n", opts->help);
 			continue;
+		} else if (!opts->help) {
+			continue;
 		}
 
 		pos = fprintf(stderr, "    ");
diff --git a/parse-options.h b/parse-options.h
index a8760ac..de249a0 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -49,7 +49,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
  *
  * `help`::
  *   the short help associated to what the option does.
- *   Must never be NULL (except for OPTION_END).
+ *   option with this field set to NULL does not appear in the help listing.
  *   OPTION_GROUP uses this pointer to store the group header.
  *
  * `flags`::
-- 
1.5.3.6.1779.ga3ed

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-19  9:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-19  6:09 [PATCH/RFC] parse-options: allow to define hidden synonym options Junio C Hamano
2007-11-19  8:04 ` [PATCH Illustration] branch --contains=<commit> Junio C Hamano
2007-11-19  9:22 ` [PATCH/RFC] parse-options: allow to define hidden synonym options Pierre Habouzit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).