line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::Kingpin::Flag; |
2
|
28
|
|
|
28
|
|
421
|
use 5.008001; |
|
28
|
|
|
|
|
93
|
|
3
|
28
|
|
|
28
|
|
131
|
use strict; |
|
28
|
|
|
|
|
46
|
|
|
28
|
|
|
|
|
566
|
|
4
|
28
|
|
|
28
|
|
120
|
use warnings; |
|
28
|
|
|
|
|
55
|
|
|
28
|
|
|
|
|
924
|
|
5
|
28
|
|
|
28
|
|
10245
|
use Getopt::Kingpin::Base -base; |
|
28
|
|
|
|
|
71
|
|
|
28
|
|
|
|
|
305
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.09"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has _placeholder => undef; |
10
|
|
|
|
|
|
|
has _hidden => 0; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub placeholder { |
13
|
5
|
|
|
5
|
1
|
7
|
my $self = shift; |
14
|
5
|
|
|
|
|
8
|
my $placeholder = shift; |
15
|
|
|
|
|
|
|
|
16
|
5
|
|
|
|
|
70
|
$self->_placeholder($placeholder); |
17
|
|
|
|
|
|
|
|
18
|
5
|
|
|
|
|
52
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub hidden { |
22
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
24
|
$self->_hidden(1); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
11
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub help_str { |
30
|
244
|
|
|
244
|
1
|
351
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
244
|
|
|
|
|
453
|
my $ret = ["", "", ""]; |
33
|
|
|
|
|
|
|
|
34
|
244
|
100
|
|
|
|
3607
|
if (defined $self->short_name) { |
35
|
30
|
|
|
|
|
491
|
$ret->[0] = sprintf "-%s", $self->short_name; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
244
|
100
|
|
|
|
4314
|
if ($self->type eq "Bool") { |
39
|
182
|
|
|
|
|
3338
|
$ret->[1] = sprintf "--%s", $self->name; |
40
|
|
|
|
|
|
|
} else { |
41
|
62
|
100
|
|
|
|
1123
|
if (defined $self->_placeholder) { |
|
|
100
|
|
|
|
|
|
42
|
10
|
|
|
|
|
165
|
$ret->[1] = sprintf '--%s=%s', $self->name, $self->_placeholder; |
43
|
|
|
|
|
|
|
} elsif (defined $self->_default) { |
44
|
8
|
|
|
|
|
259
|
$ret->[1] = sprintf '--%s="%s"', $self->name, $self->_default; |
45
|
|
|
|
|
|
|
} else { |
46
|
44
|
|
|
|
|
1605
|
$ret->[1] = sprintf "--%s=%s", $self->name, uc $self->name; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
244
|
100
|
|
|
|
5070
|
$ret->[2] = defined $self->description ? $self->description : ""; |
51
|
|
|
|
|
|
|
|
52
|
244
|
|
|
|
|
4726
|
return $ret; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
__END__ |