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

[PATCH 0/3] Parse-options: spell multi-word placeholders with dashes

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 24, 2014, 17:52 UTC
Message-ID
<1395683525-2868-1-git-send-email-gitster@pobox.com>
In-Reply-To
<1395481654-5920-1-git-send-email-ilya.bobyr@gmail.com>

This is a follow-up to Ilya's 4th round of letting scripted porcelains to give argv-help to their users with their command line option parser based on "rev-parse --parseopt".

While reviewing the patch, we found that a few options to the built-in commands were described with an argv-help (the placeholder for an option parameter, e.g. "key-id" in "--gpg-sign <key-id>") that has multiple words to decribe a single entity, spelling these multiple words separated in spaces. It is more customary to spell a multi-word parameter with dashes, and the first patch in series is about making it so.

During the course of the development of the first patch, I needed a mechanical way to catch existing offenders; the last patch teaches the parse-options API implementation to find argv-help strings that contain SP or underscore.

There is one glitch, though. "update-index --cacheinfo" option takes THREE parameters: mode, sha1, and path. Because a command line option that takes multiple options is very unusual, the second patch introduces a new syntax to pass these three items as a single parameter to "--cacheinfo" option, which brings our command line argument convention more uniform and consistent. We however cannot deprecate or remove the traditional syntax, so it is still kept as an alternative "backward compatibility" syntax.

Junio C Hamano (3):
  parse-options: multi-word argh should use dash to separate words
  update-index: teach --cacheinfo a new syntax "mode,sha1,path"
  parse-options: make sure argh string does not have SP or _
 Documentation/git-cherry-pick.txt  |  6 +++---
 Documentation/git-commit.txt       |  2 +-
 Documentation/git-merge.txt        |  2 +-
 Documentation/git-notes.txt        |  2 +-
 Documentation/git-rev-parse.txt    | 16 ++++++++--------
 Documentation/git-revert.txt       |  6 +++---
 Documentation/git-update-index.txt |  8 ++++++--
 builtin/checkout.c                 |  2 +-
 builtin/commit.c                   |  2 +-
 builtin/merge.c                    |  2 +-
 builtin/notes.c                    |  2 +-
 builtin/revert.c                   |  2 +-
 builtin/tag.c                      |  2 +-
 builtin/update-index.c             | 34 +++++++++++++++++++++++++++++++---
 parse-options.c                    |  3 +++
 parse-options.h                    |  2 +-
 t/t2107-update-index-basic.sh      | 13 +++++++++++++
 17 files changed, 77 insertions(+), 29 deletions(-)
-- 
1.9.1-471-gcccbd8b
Previous: Ilya BobyrNext: Junio C Hamano
Message 18 of 23 in “rev-parse --parseopt: option argument name hints”
  1. rev-parse --parseopt: option argument name hintsIlya Bobyr, Mar 3, 2014
  2. Junio C HamanoMar 4, 2014
  3. Ilya BobyrMar 10, 2014
  4. rev-parse --parseopt: option argument name hintsIlya Bobyr, Mar 10, 2014
  5. Junio C HamanoMar 10, 2014
  6. Junio C HamanoMar 11, 2014
  7. Ilya BobyrMar 12, 2014
  8. Junio C HamanoMar 12, 2014
  9. Ilya BobyrMar 19, 2014
  10. Junio C HamanoMar 19, 2014
  11. Ilya BobyrMar 20, 2014
  12. rev-parse --parseopt: option argument name hintsIlya Bobyr, Mar 20, 2014
  13. Junio C HamanoMar 20, 2014
  14. Ilya BobyrMar 20, 2014
  15. Ilya BobyrMar 21, 2014
  16. Junio C HamanoMar 21, 2014
  17. rev-parse --parseopt: option argument name hintsIlya Bobyr, Mar 22, 2014
  18. 0/3 Parse-options: spell multi-word placeholders with dashesJunio C Hamano, Mar 24, 2014
  19. 1/3 parse-options: multi-word argh should use dash to separate wordsJunio C Hamano, Mar 24, 2014
  20. 2/3 update-index: teach --cacheinfo a new syntax "mode,sha1,path"Junio C Hamano, Mar 24, 2014
  21. 3/3 parse-options: make sure argh string does not have SP or _Junio C Hamano, Mar 24, 2014
  22. Eric SunshineMar 20, 2014
  23. Ilya BobyrMar 21, 2014

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.