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

Re: [PATCH 3/4] add -p: optionally prompt for single characters

From
Jeff King <peff@peff.net>
Date
Feb 3, 2009, 06:24 UTC
Message-ID
<20090203062437.GB21367@sigill.intra.peff.net>
In-Reply-To
<1233611191-18590-4-git-send-email-trast@student.ethz.ch>
On Mon, Feb 02, 2009 at 10:46:30PM +0100, Thomas Rast wrote:
Show 5 quoted lines
> +interactive.readkey::
> +	Attempt to use Term::ReadKey facilities to allow typing
> +	one-letter input with a single key.  Currently only used by
> +	the `\--patch` mode of linkgit:git-add[1].  Silently disabled
> +	if Term::ReadKey is not available.

Minor nit: the name of this variable implies that it will be used across all interactive commands (including any future ones). But the description is intimately linked with perl. Maybe structure it like "here is what this does in general, but here are some specific caveats". Something like:

  interactive.readkey::
        In interactive programs, allow the user to provide one-letter
        input with a single key (i.e., without hitting enter). Currently
        this is used only by the `\--patch` mode of linkgit:git-add[1].
        Note that this feature is silently disabled for Perl programs
        (like git-add) if Term::ReadKey is not available.

But since there is only _one_ place it is used now, and since that program _is_ a Perl program, maybe this is overengineering.

Other than that, your series looks OK to me. I think it would be nice to have a 5/4 that extends the feature to other menus for the sake of consistency. But like you, I really just use "git add -p" myself.

-Peff
Previous: Thomas RastNext: Thomas Rast
Message 6 of 13 in “add -p: Term::ReadKey and more”
  1. 0/4 add -p: Term::ReadKey and moreThomas Rast, Feb 2, 2009
  2. 1/4 add -p: change prompt separator for 'g'Thomas Rast, Feb 2, 2009
  3. 2/4 add -p: trap Ctrl-D in 'goto' modeThomas Rast, Feb 2, 2009
  4. 3/4 add -p: optionally prompt for single charactersThomas Rast, Feb 2, 2009
  5. 4/4 add -p: print errors in help colorsThomas Rast, Feb 2, 2009
  6. Jeff KingFeb 3, 2009
  7. add -i: accept single-keypress inputThomas Rast, Feb 3, 2009
  8. Junio C HamanoFeb 3, 2009
  9. Thomas RastFeb 3, 2009
  10. Junio C HamanoFeb 4, 2009
  11. Thomas RastFeb 4, 2009
  12. Thomas RastFeb 4, 2009
  13. Junio C HamanoFeb 4, 2009

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.