This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 5d7cae0a5caeeb58769245c962df6cc3f1ecf79a
Author: Tatsuhiko Miyagawa <miyag...@bulknews.net>
Date:   Fri Jul 1 14:49:56 2011 -0700

    Implemented alias like git
---
 Makefile.PL       |  1 +
 lib/Carton/CLI.pm | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/Makefile.PL b/Makefile.PL
index 4279032..79a30a8 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -15,6 +15,7 @@ requires 'Try::Tiny', 0.09;
 requires 'parent', 0.223;
 requires 'Config::GitLike', 1.05;
 requires 'Mouse', 0.93;
+requires 'Text::ParseWords', 3.10;
 
 install_script 'bin/carton';
 
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index eb9fcad..8eca724 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -72,6 +72,12 @@ sub run {
     push @commands, @ARGV;
 
     my $cmd = shift @commands || 'usage';
+
+    if (my @alias = $self->find_alias($cmd)) {
+        $cmd = shift @alias;
+        unshift @commands, @alias;
+    }
+
     my $call = $self->can("cmd_$cmd");
 
     if ($call) {
@@ -86,6 +92,16 @@ sub run {
     }
 }
 
+sub find_alias {
+    my($self, $cmd) = @_;
+
+    my $alias = $self->config->get(key => "alias.$cmd")
+        or return;
+
+    require Text::ParseWords;
+    return Text::ParseWords::shellwords($alias);
+}
+
 sub commands {
     my $self = shift;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/carton.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to