GitGot/Command/list.pm

filter: Statementstmt 86.4% 32 / 37 Branchbran 78.5% 11 / 14 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 4 / 4 Subroutinesub 100% 8 / 8 Podpod 50.0% 1 / 2 totaltotal 87.3% 62 / 71 CC 11 SCAR 20.7
CC
11
Cov
86%
_execute
12.3
BEGIN
1.0
BEGIN
1.0
CRAP 7.9
« GitGot/Command/clone.pm ↑ Summary GitGot/Command/lib.pm »
1 package App::GitGot::Command::list;
2 16 our $AUTHORITY = 'cpan:GENEHACK';
3 16 $App::GitGot::Command::list::VERSION = '1.339';
4 # ABSTRACT: list managed repositories
5 16 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 16 ▶use Class::Load 'try_load_class';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 16 ▶use App::GitGot -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 16 extends 'App::GitGot::Command';
13 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 45 ▶sub command_names { qw/ list ls / }
Subroutine command_names: called CC=1 SCAR=0.0
Pod documented
16  
17 3 ▶sub options {
Subroutine options: called CC=1 SCAR=0.0
Pod undocumented
18 3 my( $class , $app ) = @_;
19 return (
20 3 [ 'json|j' => 'stream output as JSON' ] ,
21 );
22 }
23  
24 3 ▶sub _execute {
Subroutine _execute: called CC=11 SCAR=25.1
25 3 my( $self, $opt, $args ) = @_;
26  
27 3 ▶ if ( $self->opt->json ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->opt->json) 0 3 3
28 0 ▶ try_load_class( 'JSON::MaybeXS' )
Branch: 1 branch
BranchTrueFalseTotal
try_load_class("JSON::MaybeXS") or die "json serializing requires the module 'JSON::MaybeXS' to be installed\n" 0 0 0
29 or die "json serializing requires the module 'JSON::MaybeXS' to be installed\n";
30  
31 0 my @data = map { {%$_} } $self->active_repos;
32  
33 0 say JSON::MaybeXS->new(pretty => 1)->encode( \@data );
34 0 return;
35 }
36  
37 3 for my $repo ( $self->active_repos ) {
38 12 ▶ my $repo_remote = ( $repo->repo and -d $repo->path ) ? $repo->repo
Branch: 3 branches
BranchTrueFalseTotal
$repo->repo && -d $repo->path ? : 3 9 12
$repo->repo ? : 3 6 9
-d $repo->path ? : 3 3 6
Condition100%3/3
$repo->repo and -d $repo->path
!ll&&!rl&&r
633
MC/DC100%2/2
$repo->repo and -d $repo->path
$repo->repo -d $repo->path
Truth table100%3/3
A and B
A= $repo->repoB= -d $repo->path
ABresult
0X0
100
111
39 : ( $repo->repo ) ? $repo->repo . ' (Not checked out)'
40 : ( -d $repo->path ) ? 'NO REMOTE'
41 : 'ERROR: No remote and no repo?!';
42  
43 12 printf "%3d) ", $repo->number;
44  
45 12 ▶ if ( $self->quiet ) { say $repo->label }
Branch: 1 branch
BranchTrueFalseTotal
if ($self->quiet) { } 4 8 12
46 else {
47 8 my $max_len = $self->max_length_of_an_active_repo_label;
48  
49 8 printf "%-${max_len}s %-4s %s\n", $repo->label, $repo->type, $repo_remote;
50  
51 8 ▶ if ( $self->verbose and $repo->tags ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verbose and $repo->tags) 1 7 8
Condition100%3/3
$self->verbose and $repo->tags
!ll&&!rl&&r
431
MC/DC100%2/2
$self->verbose and $repo->tags
$self->verbose $repo->tags
Truth table100%3/3
A and B
A= $self->verboseB= $repo->tags
ABresult
0X0
100
111
52 1 printf " tags: %s\n" , $repo->tags
53 }
54 }
55 }
56 }
57  
58 16 1;
59  
60 ## FIXME docs
61  
62 __END__
« GitGot/Command/clone.pm ↑ Summary GitGot/Command/lib.pm »