line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::GitGot::Command::list; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENEHACK'; |
3
|
|
|
|
|
|
|
$App::GitGot::Command::list::VERSION = '1.337'; |
4
|
|
|
|
|
|
|
# ABSTRACT: list managed repositories |
5
|
15
|
|
|
15
|
|
10287
|
use 5.014; |
|
15
|
|
|
|
|
69
|
|
6
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
216
|
use Class::Load 'try_load_class'; |
|
15
|
|
|
|
|
39
|
|
|
15
|
|
|
|
|
940
|
|
8
|
|
|
|
|
|
|
|
9
|
15
|
|
|
15
|
|
1341
|
use App::GitGot -command; |
|
15
|
|
|
|
|
56
|
|
|
15
|
|
|
|
|
118
|
|
10
|
|
|
|
|
|
|
|
11
|
15
|
|
|
15
|
|
4955
|
use Moo; |
|
15
|
|
|
|
|
48
|
|
|
15
|
|
|
|
|
102
|
|
12
|
|
|
|
|
|
|
extends 'App::GitGot::Command'; |
13
|
15
|
|
|
15
|
|
4507
|
use namespace::autoclean; |
|
15
|
|
|
|
|
41
|
|
|
15
|
|
|
|
|
100
|
|
14
|
|
|
|
|
|
|
|
15
|
45
|
|
|
45
|
1
|
58471
|
sub command_names { qw/ list ls / } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub options { |
18
|
3
|
|
|
3
|
0
|
333
|
my( $class , $app ) = @_; |
19
|
|
|
|
|
|
|
return ( |
20
|
3
|
|
|
|
|
29
|
[ 'json|j' => 'stream output as JSON' ] , |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _execute { |
25
|
3
|
|
|
3
|
|
13
|
my( $self, $opt, $args ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
3
|
50
|
|
|
|
27
|
if ( $self->opt->json ) { |
28
|
0
|
0
|
|
|
|
0
|
try_load_class( 'JSON' ) |
29
|
|
|
|
|
|
|
or die "json serializing requires the module 'JSON' to be installed\n"; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
my @data = map { {%$_} } $self->active_repos; |
|
0
|
|
|
|
|
0
|
|
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
say JSON::to_json( \@data, { pretty => 1 } ); |
34
|
0
|
|
|
|
|
0
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
92
|
for my $repo ( $self->active_repos ) { |
38
|
12
|
100
|
100
|
|
|
1059
|
my $repo_remote = ( $repo->repo and -d $repo->path ) ? $repo->repo |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
39
|
|
|
|
|
|
|
: ( $repo->repo ) ? $repo->repo . ' (Not checked out)' |
40
|
|
|
|
|
|
|
: ( -d $repo->path ) ? 'NO REMOTE' |
41
|
|
|
|
|
|
|
: 'ERROR: No remote and no repo?!'; |
42
|
|
|
|
|
|
|
|
43
|
12
|
|
|
|
|
86
|
printf "%3d) ", $repo->number; |
44
|
|
|
|
|
|
|
|
45
|
12
|
100
|
|
|
|
585
|
if ( $self->quiet ) { say $repo->label } |
|
4
|
|
|
|
|
137
|
|
46
|
|
|
|
|
|
|
else { |
47
|
8
|
|
|
|
|
246
|
my $max_len = $self->max_length_of_an_active_repo_label; |
48
|
|
|
|
|
|
|
|
49
|
8
|
|
|
|
|
51
|
printf "%-${max_len}s %-4s %s\n", $repo->label, $repo->type, $repo_remote; |
50
|
|
|
|
|
|
|
|
51
|
8
|
100
|
100
|
|
|
324
|
if ( $self->verbose and $repo->tags ) { |
52
|
1
|
|
|
|
|
62
|
printf " tags: %s\n" , $repo->tags |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
## FIXME docs |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |