| 1 | # ABSTRACT: List known stacks in the repository | ||||||||||||||
| 2 | |||||||||||||||
| 3 | package Pinto::Action::Stacks; | ||||||||||||||
| 4 | |||||||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 1 | ▶ | use MooseX::StrictConstructor; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 1 | ▶ | use MooseX::Types::Moose qw(Str); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 1 | ▶ | use MooseX::MarkAsMethods ( autoclean => 1 ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | 1 | ▶ | use List::Util qw(max); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | 1 | ▶ | use Pinto::Constants qw(:color); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | |||||||||||||||
| 14 | #------------------------------------------------------------------------------ | ||||||||||||||
| 15 | |||||||||||||||
| 16 | 1 | our $VERSION = '0.14'; # VERSION | |||||||||||||
| 17 | |||||||||||||||
| 18 | #------------------------------------------------------------------------------ | ||||||||||||||
| 19 | |||||||||||||||
| 20 | 1 | extends 'Pinto::Action'; | |||||||||||||
| 21 | |||||||||||||||
| 22 | #------------------------------------------------------------------------------ | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 1 | has format => ( | |||||||||||||
| 25 | is => 'ro', | ||||||||||||||
| 26 | isa => Str, | ||||||||||||||
| 27 | ); | ||||||||||||||
| 28 | |||||||||||||||
| 29 | #------------------------------------------------------------------------------ | ||||||||||||||
| 30 | |||||||||||||||
| 31 | 0 | ▶ | sub execute { | ||||||||||||
|
Subroutine
execute: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||
| 32 | 0 | my ($self) = @_; | |||||||||||||
| 33 | |||||||||||||||
| 34 | 0 | my @stacks = sort { $a cmp $b } $self->repo->get_all_stacks; | |||||||||||||
| 35 | |||||||||||||||
| 36 | 0 | ▶ | my $max_name = max( map { length( $_->name ) } @stacks ) || 0; | ||||||||||||
|
Condition0%0/2
&max(map({length $_->name;} @stacks)) || 0
MC/DC0%0/1
&max(map({length $_->name;} @stacks)) || 0
&max(map({length $_->name;} @stacks))
Truth table0%0/2
A
A= &max(map({length $_->name;} @stacks))
| |||||||||||||||
| 37 | 0 | ▶ | my $max_user = max( map { length( $_->head->username ) } @stacks ) || 0; | ||||||||||||
|
Condition0%0/2
&max(map({length $_->head->username;} @stacks)) || 0
MC/DC0%0/1
&max(map({length $_->head->username;} @stacks)) || 0
&max(map({length $_->head->username;} @stacks))
Truth table0%0/2
A
A= &max(map({length $_->head->username;} @stacks))
| |||||||||||||||
| 38 | |||||||||||||||
| 39 | 0 | ▶ | my $format = $self->format || "%M%L %-${max_name}k %u %-{$max_user}j %i: %{40}T"; | ||||||||||||
|
Condition0%0/2
$self->format || "%M%L %-${max_name}k %u %-{$max_user}j %i: %{40}T"
MC/DC0%0/1
$self->format || "%M%L %-${max_name}k %u %-{$max_user}j %i: %{40}T"
$self->format
Truth table0%0/2
A
A= $self->format
| |||||||||||||||
| 40 | |||||||||||||||
| 41 | 0 | for my $stack (@stacks) { | |||||||||||||
| 42 | 0 | my $string = $stack->to_string($format); | |||||||||||||
| 43 | |||||||||||||||
| 44 | 0 | ▶ | my $color = | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 45 | $stack->is_default ? $PINTO_PALETTE_COLOR_0 | ||||||||||||||
| 46 | : $stack->is_locked ? $PINTO_PALETTE_COLOR_2 | ||||||||||||||
| 47 | : undef; | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 0 | $self->show( $string, { color => $color } ); | |||||||||||||
| 50 | } | ||||||||||||||
| 51 | |||||||||||||||
| 52 | 0 | return $self->result; | |||||||||||||
| 53 | } | ||||||||||||||
| 54 | |||||||||||||||
| 55 | #------------------------------------------------------------------------------ | ||||||||||||||
| 56 | |||||||||||||||
| 57 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||
| 58 | |||||||||||||||
| 59 | #------------------------------------------------------------------------------ | ||||||||||||||
| 60 | |||||||||||||||
| 61 | 1 | 1; | |||||||||||||
| 62 | |||||||||||||||
| 63 | __END__ | ||||||||||||||