Skip to content

parse-options: no- symmetry

René Scharfe git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3test-parse-options: convert to OPT_BOOL()t/t0040-parse-options.sh test-parse-options.c+66 -60 replies
2/3parse-options: allow positivation of options starting, with no-Documentation/technical/api-parse-options.txt parse-options.c t/t0040-parse-options.sh+20 -129 replies
3/3parse-options: remove PARSE_OPT_NEGHELPbuiltin/fast-export.c builtin/grep.c parse-options.c +1 more+10 -196 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] parse-options: no- symmetry

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(-)
Signature · 1 line
1.7.9.2