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

[PATCH 0/5] parse-options: allow -h as a short option

From
René Scharfe <l.s.r@web.de>
Date
Nov 17, 2015, 10:19 UTC
Message-ID
<564AFF32.1030406@web.de>

The short option -h is hard-wired in parseopt to list the options of a command together with a short explanation. If -h is to be given a different meaning then the flag PARSE_OPT_NO_INTERNAL_HELP has to be specified, which turns off handling for -h, --help and --help-all (except that --help handling is effectively overridden by git.c, but that's a different story).

Most commands that do that, grep and show-ref in particular, still show the usage when -h is specified as the only parameter and with --help-all by implementing explicit handlers for them. This series makes it easier for them by letting them override -h handling without any flag.

Rene Scharfe (5):
  parse-options: deduplicate parse_options_usage() calls
  parse-options: inline parse_options_usage() at its only remaining caller
  parse-options: allow -h as a short option
  grep: stop using PARSE_OPT_NO_INTERNAL_HELP
  show-ref: stop using PARSE_OPT_NO_INTERNAL_HELP
 builtin/grep.c     | 17 +----------------
 builtin/show-ref.c | 12 +-----------
 parse-options.c    | 40 ++++++++++++++++++++--------------------
 parse-options.h    |  2 +-
 4 files changed, 23 insertions(+), 48 deletions(-)
-- 
2.6.3
Next: René Scharfe
Message 1 of 7 in “parse-options: allow -h as a short option”
  1. 0/5 parse-options: allow -h as a short optionRené Scharfe, Nov 17, 2015
  2. 1/5 parse-options: deduplicate parse_options_usage() callsRené Scharfe, Nov 17, 2015
  3. 2/5 parse-options: inline parse_options_usage() at its only remaining callerRené Scharfe, Nov 17, 2015
  4. 3/5 parse-options: allow -h as a short optionRené Scharfe, Nov 17, 2015
  5. 4/5 grep: stop using PARSE_OPT_NO_INTERNAL_HELPRené Scharfe, Nov 17, 2015
  6. 5/5 show-ref: stop using PARSE_OPT_NO_INTERNAL_HELPRené Scharfe, Nov 17, 2015
  7. Junio C HamanoDec 4, 2015

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.