| 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
| |||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | try_load_class( 'JSON::MaybeXS' ) | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 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
Condition100%3/3
$repo->repo and -d $repo->path
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
| |||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||
| 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
Condition100%3/3
$self->verbose and $repo->tags
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
| |||||||||||||||||||||||||||||||||||||
| 52 | 1 | printf " tags: %s\n" , $repo->tags | |||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||
| 58 | 16 | 1; | |||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||
| 60 | ## FIXME docs | ||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||||||||||