line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YA::CLI::Usage; |
2
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
3
|
1
|
|
|
1
|
|
1166
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
636
|
use namespace::autoclean; |
|
1
|
|
|
|
|
10652
|
|
|
1
|
|
|
|
|
2
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Class that handles usage and man page generation for action handlers |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
68
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
9
|
1
|
|
|
1
|
|
5
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
10
|
1
|
|
|
1
|
|
5
|
use Pod::Find qw(pod_where); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
11
|
1
|
|
|
1
|
|
461
|
use Pod::Usage qw(pod2usage); |
|
1
|
|
|
|
|
39709
|
|
|
1
|
|
|
|
|
208
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has verbose => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
default => 1, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has rc => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
default => 0, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has message => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
predicate => 'has_message', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has pod_file => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
predicate => 'has_pod_file' |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub run { |
34
|
9
|
|
|
9
|
1
|
1297
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
|
|
20
|
my $pod_where = $self->_pod_where; |
37
|
|
|
|
|
|
|
|
38
|
9
|
100
|
|
|
|
77
|
$self->_pod2usage( |
|
|
100
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$self->has_message ? (-message => $self->message) : (), |
40
|
|
|
|
|
|
|
-verbose => $self->verbose, |
41
|
|
|
|
|
|
|
-exitval => $self->rc, |
42
|
|
|
|
|
|
|
$pod_where ? ('-input' => $pod_where) : (), |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _pod_where { |
47
|
0
|
|
|
0
|
|
|
my $self = shift; |
48
|
0
|
0
|
|
|
|
|
return unless $self->has_pod_file; |
49
|
0
|
|
|
|
|
|
return pod_where({ -inc => 1 }, $self->pod_file); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _pod2usage { |
53
|
0
|
|
|
0
|
|
|
my $self = shift; |
54
|
0
|
|
|
|
|
|
pod2usage(@_); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |