git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] parse-options: make OPT_NUMBER's argh explicit
@ 2009-06-03  7:49 Stephen Boyd
  2009-06-03 10:18 ` René Scharfe
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2009-06-03  7:49 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

OPTION_NUMBER hard codes its argh member to be "n", but the decision is
hidden deep in usage_with_options_internal(). Make "n" the default argh
for the OPT_NUMBER macro while leaving it undecided for the OPTION_NUMBER
enum.

This make it less surprising to users that argh is "n" when using the
OPT_NUMBER macro.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 builtin-tag.c   |    4 ++--
 parse-options.c |   11 ++---------
 parse-options.h |    2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/builtin-tag.c b/builtin-tag.c
index dc3db62..080e04a 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -376,8 +376,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 	struct commit_list *with_commit = NULL;
 	struct option options[] = {
 		OPT_BOOLEAN('l', NULL, &list, "list tag names"),
-		{ OPTION_INTEGER, 'n', NULL, &lines, NULL,
-				"print n lines of each tag message",
+		{ OPTION_INTEGER, 'n', NULL, &lines, "n",
+				"print <n> lines of each tag message",
 				PARSE_OPT_OPTARG, NULL, 1 },
 		OPT_BOOLEAN('d', NULL, &delete, "delete tags"),
 		OPT_BOOLEAN('v', NULL, &verify, "verify tags"),
diff --git a/parse-options.c b/parse-options.c
index b85cab2..48ba62b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -503,19 +503,12 @@ int usage_with_options_internal(const char * const *usagestr,
 		switch (opts->type) {
 		case OPTION_ARGUMENT:
 			break;
-		case OPTION_INTEGER:
-			if (opts->flags & PARSE_OPT_OPTARG)
-				if (opts->long_name)
-					pos += fprintf(stderr, "[=<n>]");
-				else
-					pos += fprintf(stderr, "[<n>]");
-			else
-				pos += fprintf(stderr, " <n>");
-			break;
 		case OPTION_CALLBACK:
 			if (opts->flags & PARSE_OPT_NOARG)
 				break;
 			/* FALLTHROUGH */
+		case OPTION_INTEGER:
+			/* FALLTHROUGH */
 		case OPTION_FILENAME:
 			/* FALLTHROUGH */
 		case OPTION_STRING:
diff --git a/parse-options.h b/parse-options.h
index b374ade..b141ae6 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -108,7 +108,7 @@ struct option {
 #define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
 #define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
 #define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
-#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
+#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), "n", (h) }
 #define OPT_STRING(s, l, v, a, h)   { OPTION_STRING,  (s), (l), (v), (a), (h) }
 #define OPT_DATE(s, l, v, h) \
 	{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
-- 
1.6.3.1.244.gf9275

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

* Re: [PATCH] parse-options: make OPT_NUMBER's argh explicit
  2009-06-03  7:49 [PATCH] parse-options: make OPT_NUMBER's argh explicit Stephen Boyd
@ 2009-06-03 10:18 ` René Scharfe
  2009-06-03 19:35   ` Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: René Scharfe @ 2009-06-03 10:18 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: git, Junio C Hamano

Stephen Boyd schrieb:
> OPTION_NUMBER hard codes its argh member to be "n", but the decision is
> hidden deep in usage_with_options_internal(). Make "n" the default argh
> for the OPT_NUMBER macro while leaving it undecided for the OPTION_NUMBER
> enum.
> 
> This make it less surprising to users that argh is "n" when using the
> OPT_NUMBER macro.
> 
> Signed-off-by: Stephen Boyd <bebarino@gmail.com>
> ---
>  builtin-tag.c   |    4 ++--
>  parse-options.c |   11 ++---------
>  parse-options.h |    2 +-
>  3 files changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/builtin-tag.c b/builtin-tag.c
> index dc3db62..080e04a 100644
> --- a/builtin-tag.c
> +++ b/builtin-tag.c
> @@ -376,8 +376,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
>  	struct commit_list *with_commit = NULL;
>  	struct option options[] = {
>  		OPT_BOOLEAN('l', NULL, &list, "list tag names"),
> -		{ OPTION_INTEGER, 'n', NULL, &lines, NULL,
> -				"print n lines of each tag message",
> +		{ OPTION_INTEGER, 'n', NULL, &lines, "n",
> +				"print <n> lines of each tag message",
>  				PARSE_OPT_OPTARG, NULL, 1 },
>  		OPT_BOOLEAN('d', NULL, &delete, "delete tags"),
>  		OPT_BOOLEAN('v', NULL, &verify, "verify tags"),
> diff --git a/parse-options.c b/parse-options.c
> index b85cab2..48ba62b 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -503,19 +503,12 @@ int usage_with_options_internal(const char * const *usagestr,
>  		switch (opts->type) {
>  		case OPTION_ARGUMENT:
>  			break;
> -		case OPTION_INTEGER:
> -			if (opts->flags & PARSE_OPT_OPTARG)
> -				if (opts->long_name)
> -					pos += fprintf(stderr, "[=<n>]");
> -				else
> -					pos += fprintf(stderr, "[<n>]");
> -			else
> -				pos += fprintf(stderr, " <n>");
> -			break;
>  		case OPTION_CALLBACK:
>  			if (opts->flags & PARSE_OPT_NOARG)
>  				break;
>  			/* FALLTHROUGH */
> +		case OPTION_INTEGER:
> +			/* FALLTHROUGH */
>  		case OPTION_FILENAME:
>  			/* FALLTHROUGH */
>  		case OPTION_STRING:
> diff --git a/parse-options.h b/parse-options.h
> index b374ade..b141ae6 100644
> --- a/parse-options.h
> +++ b/parse-options.h
> @@ -108,7 +108,7 @@ struct option {
>  #define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
>  #define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
>  #define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
> -#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
> +#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), "n", (h) }
>  #define OPT_STRING(s, l, v, a, h)   { OPTION_STRING,  (s), (l), (v), (a), (h) }
>  #define OPT_DATE(s, l, v, h) \
>  	{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \

Nice code reduction.  s/NUMBER/INTEGER/ in the commit message?

By the way, can the switch be replaced by a simple check for
PARSE_OPT_NOARG now?

René

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

* Re: [PATCH] parse-options: make OPT_NUMBER's argh explicit
  2009-06-03 10:18 ` René Scharfe
@ 2009-06-03 19:35   ` Stephen Boyd
  2009-06-03 20:22     ` René Scharfe
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2009-06-03 19:35 UTC (permalink / raw)
  To: René Scharfe; +Cc: git, Junio C Hamano

On Wed, Jun 3, 2009 at 3:18 AM, René Scharfe<rene.scharfe@lsrfire.ath.cx> wrote:
>
> Nice code reduction.  s/NUMBER/INTEGER/ in the commit message?

Oops. Thanks, I'll fix that.

>
> By the way, can the switch be replaced by a simple check for
> PARSE_OPT_NOARG now?
>

This looks possible. I think just set PARSE_OPT_NOARG as the flag of
the appropriate OPT_* macros. I'll have to grep the tree for custom
uses of OPTION_* though.

Should that be all squashed together? Or maybe that could be a follow up patch?

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

* Re: [PATCH] parse-options: make OPT_NUMBER's argh explicit
  2009-06-03 19:35   ` Stephen Boyd
@ 2009-06-03 20:22     ` René Scharfe
  2009-06-04 23:43       ` [PATCHv2 1/2] parse-options: make OPT_INTEGER's " Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: René Scharfe @ 2009-06-03 20:22 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: git, Junio C Hamano

Stephen Boyd schrieb:
> On Wed, Jun 3, 2009 at 3:18 AM, René Scharfe<rene.scharfe@lsrfire.ath.cx> wrote:
>> By the way, can the switch be replaced by a simple check for
>> PARSE_OPT_NOARG now?
>>
> 
> This looks possible. I think just set PARSE_OPT_NOARG as the flag of
> the appropriate OPT_* macros. I'll have to grep the tree for custom
> uses of OPTION_* though.

Yes, it's only worthwhile if there aren't too many special cases that
require explicit setting of PARSE_OPT_NOARG.

> 
> Should that be all squashed together? Or maybe that could be a follow up patch?

Your existing patch looks fine as is, I'd keep additional changes
separate.

Hmm, and how about the following in between them?

 parse-options.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index b85cab2..dda36b1 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -440,7 +440,7 @@ int parse_options(int argc, const char **argv, const char *prefix,
 static int usage_argh(const struct option *opts)
 {
 	const char *s;
-	int literal = opts->flags & PARSE_OPT_LITERAL_ARGHELP;
+	int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) || !opt->argh;
 	if (opts->flags & PARSE_OPT_OPTARG)
 		if (opts->long_name)
 			s = literal ? "[=%s]" : "[=<%s>]";
@@ -448,7 +448,7 @@ static int usage_argh(const struct option *opts)
 			s = literal ? "[%s]" : "[<%s>]";
 	else
 		s = literal ? " %s" : " <%s>";
-	return fprintf(stderr, s, opts->argh);
+	return fprintf(stderr, s, opt->argh ? opt->argh : "...");
 }
 
 #define USAGE_OPTS_WIDTH 24
@@ -519,17 +519,7 @@ int usage_with_options_internal(const char * const *usagestr,
 		case OPTION_FILENAME:
 			/* FALLTHROUGH */
 		case OPTION_STRING:
-			if (opts->argh)
-				pos += usage_argh(opts);
-			else {
-				if (opts->flags & PARSE_OPT_OPTARG)
-					if (opts->long_name)
-						pos += fprintf(stderr, "[=...]");
-					else
-						pos += fprintf(stderr, "[...]");
-				else
-					pos += fprintf(stderr, " ...");
-			}
+			pos += usage_argh(opts);
 			break;
 		default: /* OPTION_{BIT,BOOLEAN,NUMBER,SET_INT,SET_PTR} */
 			break;

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

* [PATCHv2 1/2] parse-options: make OPT_INTEGER's argh explicit
  2009-06-03 20:22     ` René Scharfe
@ 2009-06-04 23:43       ` Stephen Boyd
  2009-06-04 23:43         ` [PATCHv2 2/2] parse-options: simplify usage argh handling Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2009-06-04 23:43 UTC (permalink / raw)
  To: git; +Cc: René Scharfe, Junio C Hamano

OPTION_INTEGER hardcodes its argh member to be "n", but the decision is
hidden deep in usage_with_options_internal(). Make "n" the default argh
for the OPT_INTEGER macro while leaving it undecided for the OPTION_INTEGER
enum.

This make it less suprising to users that argh is "n" when using the
OPT_INTEGER macro.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 builtin-tag.c   |    4 ++--
 parse-options.c |   11 ++---------
 parse-options.h |    2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/builtin-tag.c b/builtin-tag.c
index dc3db62..080e04a 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -376,8 +376,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 	struct commit_list *with_commit = NULL;
 	struct option options[] = {
 		OPT_BOOLEAN('l', NULL, &list, "list tag names"),
-		{ OPTION_INTEGER, 'n', NULL, &lines, NULL,
-				"print n lines of each tag message",
+		{ OPTION_INTEGER, 'n', NULL, &lines, "n",
+				"print <n> lines of each tag message",
 				PARSE_OPT_OPTARG, NULL, 1 },
 		OPT_BOOLEAN('d', NULL, &delete, "delete tags"),
 		OPT_BOOLEAN('v', NULL, &verify, "verify tags"),
diff --git a/parse-options.c b/parse-options.c
index b85cab2..48ba62b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -503,19 +503,12 @@ int usage_with_options_internal(const char * const *usagestr,
 		switch (opts->type) {
 		case OPTION_ARGUMENT:
 			break;
-		case OPTION_INTEGER:
-			if (opts->flags & PARSE_OPT_OPTARG)
-				if (opts->long_name)
-					pos += fprintf(stderr, "[=<n>]");
-				else
-					pos += fprintf(stderr, "[<n>]");
-			else
-				pos += fprintf(stderr, " <n>");
-			break;
 		case OPTION_CALLBACK:
 			if (opts->flags & PARSE_OPT_NOARG)
 				break;
 			/* FALLTHROUGH */
+		case OPTION_INTEGER:
+			/* FALLTHROUGH */
 		case OPTION_FILENAME:
 			/* FALLTHROUGH */
 		case OPTION_STRING:
diff --git a/parse-options.h b/parse-options.h
index b374ade..b141ae6 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -108,7 +108,7 @@ struct option {
 #define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
 #define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
 #define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
-#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
+#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), "n", (h) }
 #define OPT_STRING(s, l, v, a, h)   { OPTION_STRING,  (s), (l), (v), (a), (h) }
 #define OPT_DATE(s, l, v, h) \
 	{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
-- 
1.6.3.1.266.gb11cf

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

* [PATCHv2 2/2] parse-options: simplify usage argh handling
  2009-06-04 23:43       ` [PATCHv2 1/2] parse-options: make OPT_INTEGER's " Stephen Boyd
@ 2009-06-04 23:43         ` Stephen Boyd
  2009-06-06 10:30           ` René Scharfe
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2009-06-04 23:43 UTC (permalink / raw)
  To: git; +Cc: René Scharfe, Junio C Hamano

Simplify the argh printing by simply calling usage_argh() if the option
can take an argument. Update macros defined in parse-options.h to set
the PARSE_OPT_NOARG flag.

The only other user of custom non-argument taking options is git-apply
(in this case OPTION_BOOLEAN for deprecated options). Update it to set
the PARSE_OPT_NOARG flag.

Thanks to René Scharfe for the suggestion and starter patch.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---

René, feel free to signoff if you like.

 builtin-apply.c |    6 ++++--
 parse-options.c |   33 ++++-----------------------------
 parse-options.h |   20 +++++++++++++-------
 3 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 94ba2bd..89a5185 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -3277,9 +3277,11 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 		OPT_BOOLEAN(0, "stat", &diffstat,
 			"instead of applying the patch, output diffstat for the input"),
 		{ OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary,
-		  NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
+		  NULL, "old option, now no-op",
+		  PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
 		{ OPTION_BOOLEAN, 0, "binary", &binary,
-		  NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
+		  NULL, "old option, now no-op",
+		  PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
 		OPT_BOOLEAN(0, "numstat", &numstat,
 			"shows number of added and deleted lines in decimal notation"),
 		OPT_BOOLEAN(0, "summary", &summary,
diff --git a/parse-options.c b/parse-options.c
index 48ba62b..e469fc0 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -440,7 +440,7 @@ int parse_options(int argc, const char **argv, const char *prefix,
 static int usage_argh(const struct option *opts)
 {
 	const char *s;
-	int literal = opts->flags & PARSE_OPT_LITERAL_ARGHELP;
+	int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) || !opts->argh;
 	if (opts->flags & PARSE_OPT_OPTARG)
 		if (opts->long_name)
 			s = literal ? "[=%s]" : "[=<%s>]";
@@ -448,7 +448,7 @@ static int usage_argh(const struct option *opts)
 			s = literal ? "[%s]" : "[<%s>]";
 	else
 		s = literal ? " %s" : " <%s>";
-	return fprintf(stderr, s, opts->argh);
+	return fprintf(stderr, s, opts->argh ? opts->argh : "...");
 }
 
 #define USAGE_OPTS_WIDTH 24
@@ -500,33 +500,8 @@ int usage_with_options_internal(const char * const *usagestr,
 		if (opts->type == OPTION_NUMBER)
 			pos += fprintf(stderr, "-NUM");
 
-		switch (opts->type) {
-		case OPTION_ARGUMENT:
-			break;
-		case OPTION_CALLBACK:
-			if (opts->flags & PARSE_OPT_NOARG)
-				break;
-			/* FALLTHROUGH */
-		case OPTION_INTEGER:
-			/* FALLTHROUGH */
-		case OPTION_FILENAME:
-			/* FALLTHROUGH */
-		case OPTION_STRING:
-			if (opts->argh)
-				pos += usage_argh(opts);
-			else {
-				if (opts->flags & PARSE_OPT_OPTARG)
-					if (opts->long_name)
-						pos += fprintf(stderr, "[=...]");
-					else
-						pos += fprintf(stderr, "[...]");
-				else
-					pos += fprintf(stderr, " ...");
-			}
-			break;
-		default: /* OPTION_{BIT,BOOLEAN,NUMBER,SET_INT,SET_PTR} */
-			break;
-		}
+		if (!(opts->flags & PARSE_OPT_NOARG))
+			pos += usage_argh(opts);
 
 		if (pos <= USAGE_OPTS_WIDTH)
 			pad = USAGE_OPTS_WIDTH - pos;
diff --git a/parse-options.h b/parse-options.h
index b141ae6..f65aca3 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -67,7 +67,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
  * `flags`::
  *   mask of parse_opt_option_flags.
  *   PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
- *   PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
+ *   PARSE_OPT_NOARG: says that this option takes no argument
  *   PARSE_OPT_NONEG: says that this option cannot be negated
  *   PARSE_OPT_HIDDEN: this option is skipped in the default usage, and
  *                     shown only in the full usage.
@@ -101,13 +101,19 @@ struct option {
 };
 
 #define OPT_END()                   { OPTION_END }
-#define OPT_ARGUMENT(l, h)          { OPTION_ARGUMENT, 0, (l), NULL, NULL, (h) }
+#define OPT_ARGUMENT(l, h)          { OPTION_ARGUMENT, 0, (l), NULL, NULL, \
+				      (h), PARSE_OPT_NOARG}
 #define OPT_GROUP(h)                { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
-#define OPT_BIT(s, l, v, h, b)      { OPTION_BIT, (s), (l), (v), NULL, (h), 0, NULL, (b) }
-#define OPT_NEGBIT(s, l, v, h, b)   { OPTION_NEGBIT, (s), (l), (v), NULL, (h), 0, NULL, (b) }
-#define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
-#define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
-#define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
+#define OPT_BIT(s, l, v, h, b)      { OPTION_BIT, (s), (l), (v), NULL, (h), \
+				      PARSE_OPT_NOARG, NULL, (b) }
+#define OPT_NEGBIT(s, l, v, h, b)   { OPTION_NEGBIT, (s), (l), (v), NULL, \
+				      (h), PARSE_OPT_NOARG, NULL, (b) }
+#define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, \
+				      (h), PARSE_OPT_NOARG }
+#define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, \
+				      (h), PARSE_OPT_NOARG, NULL, (i) }
+#define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, \
+				      (h), PARSE_OPT_NOARG, NULL, (p) }
 #define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), "n", (h) }
 #define OPT_STRING(s, l, v, a, h)   { OPTION_STRING,  (s), (l), (v), (a), (h) }
 #define OPT_DATE(s, l, v, h) \
-- 
1.6.3.1.266.gb11cf

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

* Re: [PATCHv2 2/2] parse-options: simplify usage argh handling
  2009-06-04 23:43         ` [PATCHv2 2/2] parse-options: simplify usage argh handling Stephen Boyd
@ 2009-06-06 10:30           ` René Scharfe
  0 siblings, 0 replies; 7+ messages in thread
From: René Scharfe @ 2009-06-06 10:30 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: git, Junio C Hamano

Stephen Boyd schrieb:
> Simplify the argh printing by simply calling usage_argh() if the option
> can take an argument. Update macros defined in parse-options.h to set
> the PARSE_OPT_NOARG flag.
> 
> The only other user of custom non-argument taking options is git-apply
> (in this case OPTION_BOOLEAN for deprecated options). Update it to set
> the PARSE_OPT_NOARG flag.
> 
> Thanks to René Scharfe for the suggestion and starter patch.
> 
> Signed-off-by: Stephen Boyd <bebarino@gmail.com>
> ---
> 
> René, feel free to signoff if you like.
> 
>  builtin-apply.c |    6 ++++--
>  parse-options.c |   33 ++++-----------------------------
>  parse-options.h |   20 +++++++++++++-------
>  3 files changed, 21 insertions(+), 38 deletions(-)

Looks good, thanks.  The output of this command:

	$ for c in ./git-*; do $c --help-all </dev/null; done

didn't change, except for git-send-email reporting a different temporary
file name (unrelated to this patch, of course).

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

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

end of thread, other threads:[~2009-06-06 10:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03  7:49 [PATCH] parse-options: make OPT_NUMBER's argh explicit Stephen Boyd
2009-06-03 10:18 ` René Scharfe
2009-06-03 19:35   ` Stephen Boyd
2009-06-03 20:22     ` René Scharfe
2009-06-04 23:43       ` [PATCHv2 1/2] parse-options: make OPT_INTEGER's " Stephen Boyd
2009-06-04 23:43         ` [PATCHv2 2/2] parse-options: simplify usage argh handling Stephen Boyd
2009-06-06 10:30           ` René Scharfe

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).