[carton] 384/472: Display usage when passed unsupported command

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:39:27 UTC 2015


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

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

commit d1c839c298189bfeee3217df94e5051e05273f5c
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Sun Aug 4 22:02:08 2013 -0700

    Display usage when passed unsupported command
---
 lib/Carton/CLI.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 6748cba..edc0765 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -52,7 +52,7 @@ sub run {
 
     my $code = try {
         my $call = $self->can("cmd_$cmd")
-          or Carton::Error::CommandNotFound->throw(error => "Could not find command '$cmd'");
+            or Carton::Error::CommandNotFound->throw(error => "Could not find command '$cmd'");
         $self->$call(@commands);
         return 0;
     } catch {
@@ -60,6 +60,10 @@ sub run {
 
         if ($_->isa('Carton::Error::CommandExit')) {
             return $_->code || 255;
+        } elsif ($_->isa('Carton::Error::CommandNotFound')) {
+            warn $_->error, "\n\n";
+            $self->cmd_usage;
+            return 255;
         } elsif ($_->isa('Carton::Error')) {
             warn $_->error, "\n";
             return 255;

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



More information about the Pkg-perl-cvs-commits mailing list