line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Meta::Role::Class::Simple; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
10658
|
use utf8; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
38
|
|
6
|
6
|
|
|
6
|
|
255
|
use 5.010; |
|
6
|
|
|
|
|
23
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
35
|
use namespace::autoclean; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
37
|
|
9
|
6
|
|
|
6
|
|
464
|
use Moose::Role; |
|
6
|
|
|
|
|
59
|
|
|
6
|
|
|
|
|
39
|
|
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; |