[libcatmandu-perl] 07/16: ignore deleted commands

Jonas Smedegaard dr at jones.dk
Thu Dec 4 14:43:16 UTC 2014


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

js pushed a commit to tag 0.9209
in repository libcatmandu-perl.

commit 90512bbd5c55475f5ad995361d1d75403f5fa1de
Author: Nicolas Steenlant <nicolas.steenlant at ugent.be>
Date:   Fri Nov 21 11:27:18 2014 +0100

    ignore deleted commands
---
 lib/Catmandu/CLI.pm | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/Catmandu/CLI.pm b/lib/Catmandu/CLI.pm
index ece681d..d511136 100644
--- a/lib/Catmandu/CLI.pm
+++ b/lib/Catmandu/CLI.pm
@@ -20,6 +20,16 @@ sub VERSION {
     $Catmandu::VERSION;
 }
 
+sub deleted_commands {
+    [qw(
+        Catmandu::Cmd::exporter_info
+        Catmandu::Cmd::fix_info
+        Catmandu::Cmd::importer_info
+        Catmandu::Cmd::module_info
+        Catmandu::Cmd::store_info
+    )];
+}
+
 sub default_command { 'commands' }
 
 sub plugin_search_path { 'Catmandu::Cmd' }
@@ -158,7 +168,7 @@ sub run {
             say STDERR "Oops! Syntax error in your fixes...";
             say STDERR "\n\t$message\n";
             say STDERR "Source:\n";
-            
+
             for (split(/\n/,$source)) {
                 print STDERR "\t$_\n";
             }
@@ -169,10 +179,10 @@ sub run {
             my $message = $_->message;
             my $data    = $_->data;
             my $fix     = $_->fix;
-        
+
             say STDERR "Oops! One of your fixes threw an error...";
             say STDERR "Source: " . $_->fix;
-            say STDERR "Error: $message";    
+            say STDERR "Error: $message";
 
             use Data::Dumper;
             say STDERR "Input:\n" . Dumper($data) if defined $data;
@@ -190,4 +200,12 @@ sub run {
         return undef;
 }
 
+sub should_ignore {
+    my ($self, $cmd_class) = @_;
+    for my $cmd (@{$self->deleted_commands}) {
+        return 1 if $cmd_class->isa($cmd);
+    }
+    return;
+}
+
 1;

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



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