line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YA::CLI::Usage; |
2
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
3
|
1
|
|
|
1
|
|
1663
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
4
|
1
|
|
|
1
|
|
863
|
use namespace::autoclean; |
|
1
|
|
|
|
|
13766
|
|
|
1
|
|
|
|
|
3
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Class that handles usage and man page generation for action handlers |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
85
|
use Carp qw(croak); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
9
|
1
|
|
|
1
|
|
6
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
10
|
1
|
|
|
1
|
|
6
|
use Pod::Find qw(pod_where); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
11
|
1
|
|
|
1
|
|
593
|
use Pod::Usage qw(pod2usage); |
|
1
|
|
|
|
|
51382
|
|
|
1
|
|
|
|
|
304
|
|
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
|
1460
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
|
|
24
|
my $pod_where = $self->_pod_where; |
37
|
|
|
|
|
|
|
|
38
|
9
|
100
|
|
|
|
100
|
$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__ |