git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] parse-options: no- symmetry
@ 2012-02-25 19:07 René Scharfe
  2012-02-25 19:11 ` [PATCH 1/3] test-parse-options: convert to OPT_BOOL() René Scharfe
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: René Scharfe @ 2012-02-25 19:07 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Bert Wesarg, Geoffrey Irving, Johannes Schindelin,
	Pierre Habouzit

Boolean long options can be negated by adding a "no-" at the
beginning, unless the flag PARSE_OPT_NONEG is set.  There are
several options defined to start out with "no-" already (e.g.
format-patch --no-numbered).  Their negation with a second
"no-" looks a bit strange.

The flag PARSE_OPT_NEGHELP was introduced to avoid this
awkwardness.  It is used twice (in fast-export and grep) to
define option pairs (--data/--no-data and --index/--no-index)
whose negative part is shown in the help text.

However, PARSE_OPT_NEGHELP is strange as well.  Short options
defined with it do the opposite of what the help text says
(we currently don't have any).  And the multiple negations
are confusing.

This series adds the ability for users to negate options that
already start with "no-" by simply leaving it out.  The last
patch removes PARSE_OPT_NEGHELP as it isn't needed anymore at
that point.

  test-parse-options: convert to OPT_BOOL()
  parse-options: allow positivation of options starting with no-
  parse-options: remove PARSE_OPT_NEGHELP

 Documentation/technical/api-parse-options.txt |    3 +-
 builtin/fast-export.c                         |    4 +-
 builtin/grep.c                                |   15 +++----
 parse-options.c                               |   33 ++++++++------
 parse-options.h                               |    4 --
 t/t0040-parse-options.sh                      |   60 ++++++++++++++++++++++++-
 test-parse-options.c                          |   12 +++--
 7 files changed, 95 insertions(+), 36 deletions(-)

-- 
1.7.9.2

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

end of thread, other threads:[~2012-02-29 19:03 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-25 19:07 [PATCH 0/3] parse-options: no- symmetry René Scharfe
2012-02-25 19:11 ` [PATCH 1/3] test-parse-options: convert to OPT_BOOL() René Scharfe
2012-02-25 19:14 ` [PATCH 2/3] parse-options: allow positivation of options starting, with no- René Scharfe
2012-02-26 23:32   ` Junio C Hamano
2012-02-27  8:30     ` Thomas Rast
2012-02-27 17:18       ` Junio C Hamano
2012-02-27 17:56         ` René Scharfe
2012-02-27 20:48           ` Junio C Hamano
2012-02-28 20:12             ` [PATCH 4/3] parse-options: disallow --no-no-sth René Scharfe
2012-02-28 21:15               ` Junio C Hamano
2012-02-29 18:06                 ` René Scharfe
2012-02-29 19:02                   ` Junio C Hamano
2012-02-25 19:15 ` [PATCH 3/3] parse-options: remove PARSE_OPT_NEGHELP René Scharfe
2012-02-27 18:25   ` Jeff King
2012-02-27 18:58     ` Junio C Hamano
2012-02-27 22:26     ` René Scharfe
2012-02-28  0:34       ` Jeff King
2012-02-28 19:06   ` [PATCH 3/3 v2] " René Scharfe
2012-02-28 19:09     ` Jeff King

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).