line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PAIA::Command::config; |
2
|
4
|
|
|
4
|
|
1422
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
117
|
|
3
|
4
|
|
|
4
|
|
27
|
use v5.10; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
116
|
|
4
|
4
|
|
|
4
|
|
16
|
use parent 'App::PAIA::Command'; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
119
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
200
|
use App::PAIA::JSON; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
984
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub usage_desc { |
11
|
15
|
|
|
15
|
1
|
61541
|
"%c config %o [ key [value] ]" |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub opt_spec { |
15
|
15
|
|
|
15
|
1
|
85
|
['ini|i' => 'list configuration in sorted ini-style'], |
16
|
|
|
|
|
|
|
['delete|d=s' => 'remove a key from the configuration file']; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _execute { |
20
|
15
|
|
|
15
|
|
27
|
my ($self, $opt, $args) = @_; |
21
|
|
|
|
|
|
|
|
22
|
15
|
100
|
|
|
|
36
|
if (defined $opt->delete) { |
23
|
1
|
|
|
|
|
8
|
$self->config->load; |
24
|
1
|
|
|
|
|
4
|
$self->config->delete($opt->delete); |
25
|
1
|
|
|
|
|
3
|
$self->config->store; |
26
|
1
|
|
|
|
|
3
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
14
|
100
|
|
|
|
147
|
if (@$args) { |
30
|
8
|
|
|
|
|
20
|
my ($key, $value) = @$args; |
31
|
|
|
|
|
|
|
|
32
|
8
|
100
|
|
|
|
26
|
if (defined $value) { |
|
|
100
|
|
|
|
|
|
33
|
6
|
100
|
100
|
|
|
26
|
if (defined $self->config->file and -e $self->config->file) { |
34
|
1
|
|
|
|
|
17
|
$self->config->load; |
35
|
|
|
|
|
|
|
} |
36
|
6
|
|
|
|
|
26
|
$self->config->set( $key => $value ); |
37
|
6
|
|
|
|
|
14
|
$self->config->store; |
38
|
6
|
|
|
|
|
33
|
return; |
39
|
|
|
|
|
|
|
} elsif( defined ($value = $self->config->get($key)) ) { |
40
|
1
|
|
|
|
|
2
|
say $value; |
41
|
1
|
|
|
|
|
8
|
return; |
42
|
|
|
|
|
|
|
} else { |
43
|
1
|
|
|
|
|
5
|
exit 1; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
6
|
|
|
|
|
22
|
$self->config->load; |
48
|
|
|
|
|
|
|
|
49
|
5
|
100
|
|
|
|
16
|
if ($opt->ini) { |
50
|
2
|
|
|
|
|
6
|
foreach ( sort keys %{$self->config->{data}} ) { |
|
2
|
|
|
|
|
5
|
|
51
|
2
|
|
|
|
|
16
|
say "$_=".$self->config->get($_); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} else { |
54
|
3
|
|
|
|
|
15
|
return $self->config->{data}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
12
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |