X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=bin%2Frgit;h=2efd7b8ea1d129d8f566570a7ff9f951037c854f;hb=af98236767735990609f068a18d3a7251f2efcab;hp=6a56df7c8b0e5051ffa20dd777e58525cf399e83;hpb=876aec5a45915d4fe3b4229787c3aa3e6b56f542;p=perl%2Fmodules%2Frgit.git diff --git a/bin/rgit b/bin/rgit index 6a56df7..2efd7b8 100755 --- a/bin/rgit +++ b/bin/rgit @@ -8,10 +8,42 @@ use Cwd qw/cwd/; use File::Spec::Functions qw/catfile path/; use List::Util qw/first/; +use App::Rgit::Utils qw/:codes/; use App::Rgit; our $VERSION = '0.03'; +BEGIN { + if (-t && eval { use Term::ReadKey; 1 }) { + *policy = sub { + my ($cmd, $conf, $repo, $status, $signal) = @_; + return NEXT unless $status; + print STDERR "[a]bort, [i]gnore, [I]gnore all, [r]etry, open [s]hell ?"; + ReadMode 4; + my $key = ReadKey 0; + ReadMode 1; + print STDERR "\n"; + my %codes = ( + 'a' => LAST, + 'i' => NEXT, + 'I' => NEXT | SAVE, + 'r' => REDO, + 's' => LAST, + ); + $key = 'a' unless defined $key; + my $code = $codes{$key}; + $code = $codes{a} unless defined $code; + return $code; + }; + } else { + *policy = sub { + my ($cmd, $conf, $repo, $status, $signal) = @_; + return NEXT unless $status; + return LAST; + }; + } +} + my $cmd = first { !/^-/ } @ARGV; $cmd = ' ' unless defined $cmd; @@ -31,10 +63,11 @@ my $root = $ENV{GIT_DIR}; $root = cwd unless defined $root; exit App::Rgit->new( - git => $git, - root => $root, - cmd => $cmd, - args => \@ARGV + git => $git, + root => $root, + cmd => $cmd, + args => \@ARGV, + policy => \&policy, )->run; __END__ @@ -117,7 +150,7 @@ Add a remote to all repositories in "/foo/bar" to their bare counterpart in C, L, L, L, L and L. +The core modules L, L, L, L, L, L and L. L.