File Coverage

lib/App/gh/Command/Setup.pm
Criterion Covered Total %
statement 9 19 47.3
branch 0 8 0.0
condition 0 15 0.0
subroutine 3 4 75.0
pod 0 1 0.0
total 12 47 25.5


line stmt bran cond sub pod time code
1             package App::gh::Command::Setup;
2 1     1   1434 use warnings;
  1         3  
  1         31  
3 1     1   9 use strict;
  1         2  
  1         125  
4 1     1   6 use base qw(App::gh::Command);
  1         2  
  1         484  
5              
6             sub run {
7 0     0 0   my $self = shift;
8 0           my ( $type , $id , $arg ) = @_;
9              
10 0 0 0       print <<'END' unless ( $type && $id && $arg );
      0        
11              
12             Type, id , token|email is required.
13              
14             Setup command usage:
15              
16             \$ gh setup github [id] [token]
17              
18             \$ gh setup git [name] [email]
19              
20             See help:
21              
22             \$ gh help setup
23              
24             END
25 0 0 0       return unless ( $type && $id && $arg );
      0        
26              
27 0 0 0       if( $type eq 'github' || $type eq 'gh' ) {
    0          
28 0           qx(git config --global github.user "$id");
29 0           qx(git config --global github.token "$arg");
30             }
31             elsif( $type eq 'git' ) {
32 0           qx( git config --global user.name "$id" );
33 0           qx( git config --global user.email "$arg" );
34             }
35              
36 0           print "Done\n";
37             }
38              
39              
40              
41              
42             1;
43             __END__