File Coverage

blib/lib/App/JESP/Cmd.pm
Criterion Covered Total %
statement 18 27 66.6
branch 0 2 0.0
condition n/a
subroutine 6 9 66.6
pod 2 2 100.0
total 26 40 65.0


line stmt bran cond sub pod time code
1             package App::JESP::Cmd;
2             $App::JESP::Cmd::VERSION = '0.015';
3 1     1   3890 use App::Cmd::Setup -app;
  1         13673  
  1         8  
4 1     1   154 use strict; use warnings;
  1     1   3  
  1         15  
  1         4  
  1         1  
  1         20  
5              
6 1     1   4 use App::JESP;
  1         3  
  1         23  
7              
8 1     1   4 use Data::Dumper;
  1         2  
  1         53  
9 1     1   248 use Log::Any::Adapter;
  1         285  
  1         3  
10              
11             =head1 NAME
12              
13             App::JESP::Cmd - Command line interface.
14              
15             =cut
16              
17             =head2 global_opt_spec
18              
19             Adds verbosity level
20              
21             See L<App::Cmd>
22              
23             =cut
24              
25             sub global_opt_spec {
26 0     0 1   my ($self) = @_;
27             return (
28             [ "verbose|v", "log additional output" ],
29             [ "lib-inc|I=s@", "additional \@INC dirs", {
30 0     0     callbacks => { 'always fine' => sub { unshift @INC, @{$_[0]}; } }
  0            
31 0           } ],
32             $self->SUPER::global_opt_spec,
33             );
34             }
35              
36             =head2 execute_command
37              
38             See L<App::Cmd>
39              
40             =cut
41              
42             sub execute_command {
43 0     0 1   my ($self, $cmd, $opts, @args) = @_;
44 0 0         if( $self->global_options()->{verbose} ){
45 0           Log::Any::Adapter->set( 'Stdout' , log_level => 'debug' );
46             }else{
47 0           Log::Any::Adapter->set( 'Stdout' , log_level => 'info' );
48             }
49              
50 0           return $self->SUPER::execute_command( $cmd , $opts , @args );
51             }
52             1;