File Coverage

blib/lib/App/GitGot/Command/chdir.pm
Criterion Covered Total %
statement 18 19 94.7
branch 3 4 75.0
condition 3 6 50.0
subroutine 6 6 100.0
pod 1 1 100.0
total 31 36 86.1


line stmt bran cond sub pod time code
1             package App::GitGot::Command::chdir;
2             our $AUTHORITY = 'cpan:GENEHACK';
3             $App::GitGot::Command::chdir::VERSION = '1.337';
4             # ABSTRACT: open a subshell in a selected project
5 15     15   184822 use 5.014;
  15         124  
6              
7 15     15   123 use App::GitGot -command;
  15         49  
  15         229  
8              
9 15     15   6495 use Moo;
  15         73  
  15         206  
10             extends 'App::GitGot::Command';
11 15     15   5927 use namespace::autoclean;
  15         57  
  15         214  
12              
13 44     44 1 450053 sub command_names { qw/ chdir cd / }
14              
15             sub _execute {
16 2     2   8 my( $self, $opt, $args ) = @_;
17              
18 2 100 66     50 unless ( $self->active_repos and $self->active_repos == 1 ) {
19 1         333 say STDERR 'ERROR: You need to select a single repo';
20 1         32 exit(1);
21             }
22              
23 1         132 my( $repo ) = $self->active_repos;
24              
25 1 50 33     104 chdir $repo->path
26             or say STDERR "ERROR: Failed to chdir to repo ($!)" and exit(1);
27              
28 0           exec $ENV{SHELL};
29             }
30              
31             1;
32              
33             ### FIXME docs
34              
35             __END__