File Coverage

blib/lib/App/GitGot/Command/remove.pm
Criterion Covered Total %
statement 34 34 100.0
branch 7 8 87.5
condition 5 9 55.5
subroutine 10 10 100.0
pod 1 2 50.0
total 57 63 90.4


line stmt bran cond sub pod time code
1             package App::GitGot::Command::remove;
2             our $AUTHORITY = 'cpan:GENEHACK';
3             $App::GitGot::Command::remove::VERSION = '1.336';
4             # ABSTRACT: remove a managed repository from your config
5 15     15   7444 use 5.014;
  15         44  
6              
7 15     15   75 use List::Util qw/ any /;
  15         26  
  15         856  
8              
9 15     15   83 use App::GitGot -command;
  15         22  
  15         96  
10              
11 15     15   4258 use Moo;
  15         28  
  15         70  
12             extends 'App::GitGot::Command';
13 15     15   3921 use namespace::autoclean;
  15         35  
  15         75  
14              
15 45     45 1 32343 sub command_names { qw/ remove rm / }
16              
17             sub options {
18 3     3 0 252 my( $class , $app ) = @_;
19             return (
20 3         18 [ 'force' => 'FIXME' ] ,
21             );
22             }
23              
24 3     3   8 sub _use_io_page { 0 }
25              
26             sub _execute {
27 3     3   6 my( $self, $opt, $args ) = @_;
28              
29 3 100 66     49 unless ( $self->active_repos and @$args or $self->tags) {
      66        
30 1         211 say STDERR "ERROR: You need to select one or more repos to remove";
31 1         22 exit(1);
32             }
33              
34 2         102 my @new_repo_list;
35              
36 2         30 REPO: for my $repo ( $self->all_repos ) {
37 7         88 my $number = $repo->number;
38              
39 7 100   7   103 if ( any { $number == $_->number } $self->active_repos ) {
  7         261  
40 2         8 my $name = $repo->label;
41              
42 2 50 33     12 if ( $self->opt->force or $self->prompt_yn( "got rm: remove '$name'?" )) {
43 2 100       36 say "Removed repo '$name'" if $self->verbose;
44 2         69 next REPO;
45             }
46             }
47 5         15 push @new_repo_list , $repo;
48             }
49              
50 2         33 $self->set_full_repo_list( \@new_repo_list );
51 2         126 $self->write_config();
52             }
53              
54             1;
55              
56             ## FIXME docs
57              
58             __END__