line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Plugin::Term::Meta::Class; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1155
|
use 5.010; |
|
1
|
|
|
|
|
2
|
|
6
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
17
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
52
|
use Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
4155
|
use IO::Interactive qw(is_interactive); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
around 'command_check_attributes' => sub { |
14
|
|
|
|
|
|
|
my ($orig,$self,$command_meta,$errors,$params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$command_meta ||= $self; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if (scalar @{$errors} == 0 |
19
|
|
|
|
|
|
|
&& is_interactive()) { |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $prompt = 1; |
22
|
|
|
|
|
|
|
foreach my $attribute ($self->command_usage_attributes($command_meta,'all')) { |
23
|
|
|
|
|
|
|
if ($attribute->is_required |
24
|
|
|
|
|
|
|
&& ! exists $params->{$attribute->name} |
25
|
|
|
|
|
|
|
&& (! $attribute->can('cmd_term') || $attribute->cmd_term == 0 )) { |
26
|
|
|
|
|
|
|
$prompt = 0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
if ($prompt) { |
31
|
|
|
|
|
|
|
foreach my $attribute ($self->command_usage_attributes($command_meta,'all')) { |
32
|
|
|
|
|
|
|
next |
33
|
|
|
|
|
|
|
unless $attribute->can('cmd_term') |
34
|
|
|
|
|
|
|
&& $attribute->cmd_term; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
if (! defined $params->{$attribute->name}) { |
37
|
|
|
|
|
|
|
my $return = $attribute->cmd_term_read(); |
38
|
|
|
|
|
|
|
$params->{$attribute->name} = $return |
39
|
|
|
|
|
|
|
if defined $return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return $self->$orig($command_meta,$errors,$params); |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |