line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Meta::Role::Class::Simple; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
11795
|
use utf8; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
50
|
|
6
|
6
|
|
|
6
|
|
320
|
use 5.010; |
|
6
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
33
|
use namespace::autoclean; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
49
|
|
9
|
6
|
|
|
6
|
|
530
|
use Moose::Role; |
|
6
|
|
|
|
|
85
|
|
|
6
|
|
|
|
|
51
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around 'command_usage_header' => sub { |
12
|
|
|
|
|
|
|
my ($orig,$self) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $caller = $self->app_base; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $usage; |
17
|
|
|
|
|
|
|
# Get usage from command if available |
18
|
|
|
|
|
|
|
if ($self->can('command_usage') |
19
|
|
|
|
|
|
|
&& $self->command_usage_predicate) { |
20
|
|
|
|
|
|
|
$usage = MooseX::App::Utils::format_text($self->command_usage); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Autobuild usage |
24
|
|
|
|
|
|
|
unless ($usage) { |
25
|
|
|
|
|
|
|
my $command = $caller; |
26
|
|
|
|
|
|
|
my @parameter= $self->command_usage_attributes($self,'parameter'); |
27
|
|
|
|
|
|
|
foreach my $attribute (@parameter) { |
28
|
|
|
|
|
|
|
if ($attribute->is_required) { |
29
|
|
|
|
|
|
|
$command .= " <".$attribute->cmd_usage_name.'>'; |
30
|
|
|
|
|
|
|
} else { |
31
|
|
|
|
|
|
|
$command .= ' ['.$attribute->cmd_usage_name.']'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
$usage = MooseX::App::Utils::format_text("$command [long options...] |
35
|
|
|
|
|
|
|
$caller --help") |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return $self->command_message( |
39
|
|
|
|
|
|
|
header => 'usage:', |
40
|
|
|
|
|
|
|
body => $usage |
41
|
|
|
|
|
|
|
); # LOCALIZE |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |