git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Luc Herren <jlh@gmx.ch>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH 1/2] git-add--interactive: Allow Ctrl-D to exit
Date: Wed, 26 Sep 2007 15:56:19 +0200	[thread overview]
Message-ID: <46FA6503.5040708@gmx.ch> (raw)

Hitting Ctrl-D (EOF) is a common way to exit shell-like tools.
When in a sub-menu it will still behave as if an empty line had
been entered, carrying out the action on the selected items and
returning to the previous menu.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
---
 git-add--interactive.perl |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 7921cde..f9e9f02 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -213,7 +213,11 @@ sub list_and_choose {
 			print ">> ";
 		}
 		my $line = <STDIN>;
-		last if (!$line);
+		if (!$line) {
+			print "\n";
+			$opts->{ON_EOF}->() if $opts->{ON_EOF};
+			last;
+		}
 		chomp $line;
 		my $donesomething = 0;
 		for my $choice (split(/[\s,]+/, $line)) {
@@ -791,6 +795,7 @@ sub main_loop {
 					     SINGLETON => 1,
 					     LIST_FLAT => 4,
 					     HEADER => '*** Commands ***',
+					     ON_EOF => \&quit_cmd,
 					     IMMEDIATE => 1 }, @cmd);
 		if ($it) {
 			eval {
-- 
1.5.3

                 reply	other threads:[~2007-09-26 14:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46FA6503.5040708@gmx.ch \
    --to=jlh@gmx.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).