git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Feb 25, 2012, 19:07 UTC
Message-ID
<4F49317A.3080809@lsrfire.ath.cx>

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
Next: René Scharfe
Message 1 of 19 in “parse-options: no- symmetry”
  1. 0/3 parse-options: no- symmetryRené Scharfe, Feb 25, 2012
  2. 1/3 test-parse-options: convert to OPT_BOOL()René Scharfe, Feb 25, 2012
  3. 2/3 parse-options: allow positivation of options starting, with no-René Scharfe, Feb 25, 2012
  4. Junio C HamanoFeb 26, 2012
  5. Thomas RastFeb 27, 2012
  6. Junio C HamanoFeb 27, 2012
  7. René ScharfeFeb 27, 2012
  8. Junio C HamanoFeb 27, 2012
  9. 4/3 parse-options: disallow --no-no-sthRené Scharfe, Feb 28, 2012
  10. Junio C HamanoFeb 28, 2012
  11. René ScharfeFeb 29, 2012
  12. Junio C HamanoFeb 29, 2012
  13. 3/3 parse-options: remove PARSE_OPT_NEGHELPRené Scharfe, Feb 25, 2012
  14. Jeff KingFeb 27, 2012
  15. Junio C HamanoFeb 27, 2012
  16. René ScharfeFeb 27, 2012
  17. Jeff KingFeb 28, 2012
  18. 3/3 parse-options: remove PARSE_OPT_NEGHELPRené Scharfe, Feb 28, 2012
  19. Jeff KingFeb 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.