line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Meta::Role::Class::Simple; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
7965
|
use utf8; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
33
|
|
6
|
5
|
|
|
5
|
|
203
|
use 5.010; |
|
5
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
19
|
use namespace::autoclean; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
34
|
|
9
|
5
|
|
|
5
|
|
327
|
use Moose::Role; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
33
|
|
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; |