line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::Kingpin::Command; |
2
|
31
|
|
|
31
|
|
519
|
use 5.008001; |
|
31
|
|
|
|
|
110
|
|
3
|
31
|
|
|
31
|
|
157
|
use strict; |
|
31
|
|
|
|
|
79
|
|
|
31
|
|
|
|
|
698
|
|
4
|
31
|
|
|
31
|
|
172
|
use warnings; |
|
31
|
|
|
|
|
85
|
|
|
31
|
|
|
|
|
1229
|
|
5
|
31
|
|
|
31
|
|
206
|
use Getopt::Kingpin -base; |
|
31
|
|
|
|
|
67
|
|
|
31
|
|
|
|
|
392
|
|
6
|
31
|
|
|
31
|
|
3536
|
use Carp; |
|
31
|
|
|
|
|
91
|
|
|
31
|
|
|
|
|
14627
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.11"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub help_short { |
11
|
34
|
|
|
34
|
1
|
65
|
my $self = shift; |
12
|
34
|
|
|
|
|
594
|
my @help = ($self->name); |
13
|
|
|
|
|
|
|
|
14
|
34
|
100
|
|
|
|
723
|
if ($self->name eq "help") { |
15
|
6
|
|
|
|
|
53
|
push @help, "[...]"; |
16
|
|
|
|
|
|
|
} else { |
17
|
28
|
100
|
|
|
|
573
|
if ($self->flags->count > 1) { |
18
|
18
|
|
|
|
|
36
|
push @help, "[]"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
28
|
100
|
|
|
|
462
|
if ($self->commands->count > 0) { |
22
|
1
|
|
|
|
|
9
|
push @help, ""; |
23
|
1
|
|
|
|
|
2
|
push @help, "[ ...]"; |
24
|
|
|
|
|
|
|
} else { |
25
|
27
|
|
|
|
|
553
|
foreach my $arg ($self->args->get_all) { |
26
|
24
|
|
|
|
|
141
|
push @help, $arg->help_name(1); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
34
|
|
|
|
|
954
|
return join " ", @help; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub help { |
35
|
19
|
|
|
19
|
1
|
32
|
my $self = shift; |
36
|
19
|
|
|
|
|
295
|
printf "usage: %s %s\n", $self->parent->name, $self->help_short; |
37
|
19
|
|
|
|
|
294
|
printf "\n"; |
38
|
|
|
|
|
|
|
|
39
|
19
|
100
|
|
|
|
593
|
if ($self->description ne "") { |
40
|
18
|
|
|
|
|
469
|
printf "%s\n", $self->description; |
41
|
18
|
|
|
|
|
596
|
printf "\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
19
|
|
|
|
|
466
|
printf "%s\n", $self->flags->help; |
45
|
|
|
|
|
|
|
|
46
|
19
|
100
|
|
|
|
504
|
if ($self->args->count > 0) { |
47
|
12
|
|
|
|
|
259
|
printf "%s\n", $self->args->help; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
19
|
100
|
|
|
|
494
|
if ($self->commands->count > 1) { |
51
|
1
|
|
|
|
|
26
|
printf "Subcommands:\n"; |
52
|
1
|
|
|
|
|
27
|
foreach my $sub ($self->commands->get_all) { |
53
|
2
|
100
|
|
|
|
48
|
next if $sub->name eq "help"; |
54
|
1
|
|
|
|
|
26
|
printf " %s %s\n", $sub->parent->name, $sub->name; |
55
|
1
|
|
|
|
|
78
|
printf " %s\n", $sub->description; |
56
|
1
|
|
|
|
|
34
|
printf "\n"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |