File Coverage

lib/Smartcat/App/Command/config.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 10 0.0
condition 0 3 0.0
subroutine 4 6 66.6
pod 2 2 100.0
total 18 44 40.9


line stmt bran cond sub pod time code
1             # ABSTRACT: show/edit config file
2 2     2   1156 use strict;
  2         5  
  2         52  
3 2     2   9 use warnings;
  2         3  
  2         68  
4              
5             package Smartcat::App::Command::config;
6 2     2   9 use Smartcat::App -command;
  2         4  
  2         11  
7              
8 2     2   667 use File::Basename;
  2         3  
  2         500  
9              
10             sub validate_args {
11 0     0 1   my ( $self, $opt, $args ) = @_;
12              
13 0           my $app = $self->app;
14              
15 0 0         $app->{config}->{username} = $opt->{token_id} if defined $opt->{token_id};
16 0 0         $app->{config}->{password} = $opt->{token} if defined $opt->{token};
17 0 0         $app->{config}->{base_url} = $opt->{base_url} if defined $opt->{base_url};
18              
19 0 0         if ( defined $opt->{log} ) {
20             $self->usage_error(
21             "directory of 'log', which is set to '$opt->{log}', does not point to a valid directory"
22 0 0 0       ) unless -d dirname( $opt->{log} ) && -w _;
23 0           $app->{config}->{log} = $opt->{log};
24             }
25              
26 0           $app->{config}->save;
27             }
28              
29             sub execute {
30 0     0 1   my ( $self, $opt, $args ) = @_;
31              
32 0           my $app = $self->app->{config}->cat;
33             }
34              
35             1;