line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::Kingpin::Command; |
2
|
31
|
|
|
31
|
|
888
|
use 5.008001; |
|
31
|
|
|
|
|
105
|
|
3
|
31
|
|
|
31
|
|
162
|
use strict; |
|
31
|
|
|
|
|
55
|
|
|
31
|
|
|
|
|
653
|
|
4
|
31
|
|
|
31
|
|
155
|
use warnings; |
|
31
|
|
|
|
|
61
|
|
|
31
|
|
|
|
|
1210
|
|
5
|
31
|
|
|
31
|
|
209
|
use Getopt::Kingpin -base; |
|
31
|
|
|
|
|
70
|
|
|
31
|
|
|
|
|
314
|
|
6
|
31
|
|
|
31
|
|
3700
|
use Carp; |
|
31
|
|
|
|
|
118
|
|
|
31
|
|
|
|
|
14320
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.10"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub help_short { |
11
|
34
|
|
|
34
|
1
|
55
|
my $self = shift; |
12
|
34
|
|
|
|
|
478
|
my @help = ($self->name); |
13
|
|
|
|
|
|
|
|
14
|
34
|
100
|
|
|
|
590
|
if ($self->name eq "help") { |
15
|
6
|
|
|
|
|
38
|
push @help, "[...]"; |
16
|
|
|
|
|
|
|
} else { |
17
|
28
|
100
|
|
|
|
504
|
if ($self->flags->count > 1) { |
18
|
18
|
|
|
|
|
32
|
push @help, "[]"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
28
|
100
|
|
|
|
391
|
if ($self->commands->count > 0) { |
22
|
1
|
|
|
|
|
6
|
push @help, ""; |
23
|
1
|
|
|
|
|
2
|
push @help, "[ ...]"; |
24
|
|
|
|
|
|
|
} else { |
25
|
27
|
|
|
|
|
421
|
foreach my $arg ($self->args->get_all) { |
26
|
24
|
|
|
|
|
145
|
push @help, $arg->help_name(1); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
34
|
|
|
|
|
759
|
return join " ", @help; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub help { |
35
|
19
|
|
|
19
|
1
|
71
|
my $self = shift; |
36
|
19
|
|
|
|
|
264
|
printf "usage: %s %s\n", $self->parent->name, $self->help_short; |
37
|
19
|
|
|
|
|
256
|
printf "\n"; |
38
|
|
|
|
|
|
|
|
39
|
19
|
100
|
|
|
|
428
|
if ($self->description ne "") { |
40
|
18
|
|
|
|
|
346
|
printf "%s\n", $self->description; |
41
|
18
|
|
|
|
|
411
|
printf "\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
19
|
|
|
|
|
365
|
printf "%s\n", $self->flags->help; |
45
|
|
|
|
|
|
|
|
46
|
19
|
100
|
|
|
|
419
|
if ($self->args->count > 0) { |
47
|
12
|
|
|
|
|
236
|
printf "%s\n", $self->args->help; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
19
|
100
|
|
|
|
395
|
if ($self->commands->count > 1) { |
51
|
1
|
|
|
|
|
18
|
printf "Subcommands:\n"; |
52
|
1
|
|
|
|
|
20
|
foreach my $sub ($self->commands->get_all) { |
53
|
2
|
100
|
|
|
|
40
|
next if $sub->name eq "help"; |
54
|
1
|
|
|
|
|
18
|
printf " %s %s\n", $sub->parent->name, $sub->name; |
55
|
1
|
|
|
|
|
52
|
printf " %s\n", $sub->description; |
56
|
1
|
|
|
|
|
25
|
printf "\n"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |