| 1 | # ============================================================================ | ||||||||||||||||||||||||||||
| 2 | package MooseX::App::Meta::Role::Class::Simple; | ||||||||||||||||||||||||||||
| 3 | # ============================================================================ | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 6 | ▶ | around 'command_usage_header' => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=21.9
| |||||||||||||||||||||||||||||
| 12 | 6 | my ($orig,$self) = @_; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 6 | my $caller = $self->app_base; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 6 | my $usage; | |||||||||||||||||||||||||||
| 17 | # Get usage from command if available | ||||||||||||||||||||||||||||
| 18 | 6 | ▶ | if ($self->can('command_usage') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->can("command_usage") and $self->command_usage_predicate
MC/DC0%0/2
$self->can("command_usage") and $self->command_usage_predicate
$self->can("command_usage")
$self->command_usage_predicate
Truth table33%1/3
A and B
A= $self->can("command_usage")B= $self->command_usage_predicate
| |||||||||||||||||||||||||||||
| 19 | && $self->command_usage_predicate) { | ||||||||||||||||||||||||||||
| 20 | 0 | $usage = MooseX::App::Utils::format_text($self->command_usage); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | # Autobuild usage | ||||||||||||||||||||||||||||
| 24 | 6 | ▶ | unless ($usage) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 6 | my $command = $caller; | |||||||||||||||||||||||||||
| 26 | 6 | my @parameter= $self->command_usage_attributes($self,'parameter'); | |||||||||||||||||||||||||||
| 27 | 6 | foreach my $attribute (@parameter) { | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ($attribute->is_required) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | $command .= " <".$attribute->cmd_usage_name.'>'; | |||||||||||||||||||||||||||
| 30 | } else { | ||||||||||||||||||||||||||||
| 31 | 0 | $command .= ' ['.$attribute->cmd_usage_name.']'; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 6 | $usage = MooseX::App::Utils::format_text("$command [long options...] | |||||||||||||||||||||||||||
| 35 | $caller --help") | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 6 | return $self->command_message( | |||||||||||||||||||||||||||
| 39 | header => 'usage:', | ||||||||||||||||||||||||||||
| 40 | body => $usage | ||||||||||||||||||||||||||||
| 41 | ); # LOCALIZE | ||||||||||||||||||||||||||||
| 42 | 6 | }; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 6 | 1; | |||||||||||||||||||||||||||