File Coverage

blib/lib/App/JESP/Cmd/Command/status.pm
Criterion Covered Total %
statement 15 33 45.4
branch 0 2 0.0
condition n/a
subroutine 5 9 55.5
pod 4 4 100.0
total 24 48 50.0


line stmt bran cond sub pod time code
1             package App::JESP::Cmd::Command::status;
2             $App::JESP::Cmd::Command::status::VERSION = '0.014';
3 1     1   1795 use base qw/App::JESP::Cmd::CommandJESP/;
  1         3  
  1         118  
4 1     1   6 use strict; use warnings;
  1     1   2  
  1         21  
  1         6  
  1         1  
  1         34  
5 1     1   5 use Log::Any qw/$log/;
  1         2  
  1         6  
6              
7 1     1   615 use utf8;
  1         12  
  1         5  
8              
9             =head1 NAME
10              
11             App::JESP::Cmd::Command::status - Shows the status of patches
12              
13             =cut
14              
15             =head2 options
16              
17             See superclass L<App::JESP::Cmd::CommandJESP>
18              
19             =head2 abstract
20              
21             =head2 description
22              
23             =head2 execute
24              
25             See L<App::Cmd>
26              
27             =cut
28              
29             sub options{
30 0     0 1   my ($class, $app) = @_;
31 0           return ();
32             }
33              
34              
35 0     0 1   sub abstract { "Show the status of the plan VS the DB" }
36 0     0 1   sub description { "Show the status of the patches in the plan versus the patches recorded in the DB" }
37             sub execute {
38 0     0 1   my ($self, $opts, $args) = @_;
39              
40 0           binmode STDOUT , ':utf8';
41              
42 0           my $colorizer = $self->jesp()->colorizer();
43 0           my $status = $self->jesp->status( $opts );
44 0           foreach my $patch ( @{$status->{plan_patches} }){
  0            
45 0           print "Patch '".$patch->id()."'\n";
46 0 0         if( $patch->applied_datetime() ){
47 0           print " ".$colorizer->colored('✔︎', "bold green")." - Applied on ".$patch->applied_datetime();
48             }else{
49 0           print " ".$colorizer->colored('âš ', "bold yellow").' - Not applied yet';
50             }
51 0           print "\n";
52             }
53 0           foreach my $orphan ( @{$status->{plan_orphans}} ){
  0            
54 0           print "\n ".$colorizer->colored('⚠︎', "bold red")." Orphaned: '".$orphan."' Gone from plan?!?\n";
55             }
56             }
57              
58             1;