summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorJean-Luc Herren <jlh@gmx.ch>2007-09-26 15:56:19 +0200
committerJunio C Hamano <gitster@pobox.com>2007-09-29 23:14:16 -0700
commitc95c02486c4dd82f8910a8de1cb7c8f9db899995 (patch)
tree3a974319c856bfbfe82f78852180815a14aae1e0 /git-add--interactive.perl
parent552ce11006e39bd07efd79946f180df47aa35b4e (diff)
downloadgit-c95c02486c4dd82f8910a8de1cb7c8f9db899995.tar.gz
git-add--interactive: Allow Ctrl-D to exit
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 7921cde8cb..f9e9f02392 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 {