line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Cmd::info; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
135695
|
use Catmandu::Sane; |
|
14
|
|
|
|
|
51
|
|
|
14
|
|
|
|
|
110
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
117
|
use parent 'Catmandu::Cmd'; |
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
78
|
|
8
|
14
|
|
|
14
|
|
1044
|
use Catmandu; |
|
14
|
|
|
|
|
38
|
|
|
14
|
|
|
|
|
80
|
|
9
|
14
|
|
|
14
|
|
3102
|
use Catmandu::Util qw(pod_section); |
|
14
|
|
|
|
|
40
|
|
|
14
|
|
|
|
|
737
|
|
10
|
14
|
|
|
14
|
|
95
|
use namespace::clean; |
|
14
|
|
|
|
|
50
|
|
|
14
|
|
|
|
|
108
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub command_opt_spec { |
13
|
|
|
|
|
|
|
( |
14
|
7
|
|
|
7
|
1
|
180
|
["all", "show all module on this server"], |
15
|
|
|
|
|
|
|
["exporters", "show all Catmandu exporters"], |
16
|
|
|
|
|
|
|
["importers", "show all Catmandu importers"], |
17
|
|
|
|
|
|
|
["fixes", "show all Catmandu fixes"], |
18
|
|
|
|
|
|
|
["stores", "show all Catmandu stores"], |
19
|
|
|
|
|
|
|
["validators", "show all Catmandu validators"], |
20
|
|
|
|
|
|
|
["namespace=s", "search by namespace"], |
21
|
|
|
|
|
|
|
["max_depth=i", "maximum depth to search for modules"], |
22
|
|
|
|
|
|
|
[ |
23
|
|
|
|
|
|
|
"inc=s@", |
24
|
|
|
|
|
|
|
'override included directories (defaults to @INC)', |
25
|
|
|
|
|
|
|
{default => [@INC]} |
26
|
|
|
|
|
|
|
], |
27
|
|
|
|
|
|
|
["brief", "omit short module description"], |
28
|
|
|
|
|
|
|
["verbose|v", ""], |
29
|
|
|
|
|
|
|
["fix=s@", ""], |
30
|
|
|
|
|
|
|
["var=s%", ""], |
31
|
|
|
|
|
|
|
["preprocess|pp", ""], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub command { |
36
|
7
|
|
|
7
|
1
|
22
|
my ($self, $opts, $args) = @_; |
37
|
7
|
|
|
|
|
36
|
my $verbose = $opts->verbose; |
38
|
|
|
|
|
|
|
|
39
|
7
|
50
|
|
|
|
96
|
if (defined $opts->{namespace}) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
elsif ($opts->{all}) { |
42
|
0
|
|
|
|
|
0
|
delete $opts->{all}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ($opts->{exporters}) { |
45
|
1
|
|
|
|
|
3
|
delete $opts->{exporters}; |
46
|
1
|
|
|
|
|
3
|
$opts->{namespace} = 'Catmandu::Exporter'; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
elsif ($opts->{importers}) { |
49
|
1
|
|
|
|
|
3
|
delete $opts->{importers}; |
50
|
1
|
|
|
|
|
4
|
$opts->{namespace} = 'Catmandu::Importer'; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif ($opts->{fixes}) { |
53
|
2
|
|
|
|
|
9
|
delete $opts->{fixes}; |
54
|
2
|
|
|
|
|
8
|
$opts->{namespace} = 'Catmandu::Fix'; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
elsif ($opts->{stores}) { |
57
|
1
|
|
|
|
|
4
|
delete $opts->{stores}; |
58
|
1
|
|
|
|
|
4
|
$opts->{namespace} = 'Catmandu::Store'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
elsif ($opts->{validators}) { |
61
|
1
|
|
|
|
|
3
|
delete $opts->{stores}; |
62
|
1
|
|
|
|
|
4
|
$opts->{namespace} = 'Catmandu::Validator'; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
1
|
|
|
|
|
3
|
$opts->{namespace} = [qw(Catmandu)]; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
7
|
|
|
|
|
46
|
my ($from_args, $from_opts, $into_args, $into_opts) |
69
|
|
|
|
|
|
|
= $self->_parse_options($args); |
70
|
7
|
|
|
|
|
26
|
$from_opts->{about} = !$opts->{brief}; |
71
|
|
|
|
|
|
|
|
72
|
7
|
|
|
|
|
25
|
for my $key (qw(inc namespace max_depth)) { |
73
|
21
|
100
|
|
|
|
148
|
$from_opts->{$key} = $opts->$key if defined $opts->$key; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
7
|
|
|
|
|
77
|
my $from = Catmandu->importer('Modules', $from_opts); |
77
|
|
|
|
|
|
|
|
78
|
7
|
100
|
66
|
|
|
113
|
if (@$into_args || %$into_opts) { |
79
|
1
|
50
|
|
|
|
5
|
if ($opts->fix) { |
80
|
0
|
|
|
|
|
0
|
$from = $self->_build_fixer($opts)->fix($from); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
12
|
my $into = Catmandu->exporter($into_args->[0], $into_opts); |
84
|
1
|
|
|
|
|
6
|
$into->add_many($from); |
85
|
1
|
|
|
|
|
30
|
$into->commit; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
else { |
88
|
6
|
|
|
|
|
22
|
my $cols = [qw(name version)]; |
89
|
6
|
50
|
|
|
|
32
|
push @$cols, 'about' unless $opts->brief; |
90
|
6
|
50
|
|
|
|
53
|
push @$cols, 'file' if $opts->verbose; |
91
|
6
|
|
|
|
|
55
|
$from->format(cols => $cols); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=pod |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Catmandu::Cmd::info - list installed Catmandu modules |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This L<Catmandu::Cmd> uses L<Catmandu::Importer::Modules> to list all modules. |
108
|
|
|
|
|
|
|
By default modules are listed in tabular form, like L<Catmandu::Exporter::Table>. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 EXAMPLES |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
catmandu info --exporters |
113
|
|
|
|
|
|
|
catmandu info --importers |
114
|
|
|
|
|
|
|
catmandu info --fixes |
115
|
|
|
|
|
|
|
catmandu info --stores |
116
|
|
|
|
|
|
|
catmandu info --validators |
117
|
|
|
|
|
|
|
catmandu info --namespace=Catmandu |
118
|
|
|
|
|
|
|
catmandu info --all |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# export list of exporter modules to JSON |
121
|
|
|
|
|
|
|
catmandu info --exporters to JSON |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |