line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Cmd::drop; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
7887
|
use Catmandu::Sane; |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
112
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
110
|
use parent 'Catmandu::Cmd'; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
73
|
|
8
|
14
|
|
|
14
|
|
1043
|
use Catmandu; |
|
14
|
|
|
|
|
37
|
|
|
14
|
|
|
|
|
70
|
|
9
|
14
|
|
|
14
|
|
2978
|
use Catmandu::Util qw(check_able); |
|
14
|
|
|
|
|
52
|
|
|
14
|
|
|
|
|
676
|
|
10
|
14
|
|
|
14
|
|
90
|
use namespace::clean; |
|
14
|
|
|
|
|
43
|
|
|
14
|
|
|
|
|
89
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub command_opt_spec { |
13
|
0
|
|
|
0
|
1
|
|
(["bag=s", "drop a bag"],); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub command { |
17
|
0
|
|
|
0
|
1
|
|
my ($self, $opts, $args) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my ($from_args, $from_opts) = $self->_parse_options($args); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $from = Catmandu->store($from_args->[0], $from_opts); |
22
|
0
|
0
|
|
|
|
|
if ($opts->bag) { |
23
|
0
|
|
|
|
|
|
check_able($from->bag($opts->bag), 'drop')->drop; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
0
|
|
|
|
|
|
check_able($from, 'drop')->drop; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Catmandu::Cmd::drop - drop a store or one of its bags |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 EXAMPLES |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
catmandu drop <STORE> <OPTIONS> |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# drop the whole store |
45
|
|
|
|
|
|
|
catmandu drop ElasticSearch --index-name items |
46
|
|
|
|
|
|
|
# drop a single bag |
47
|
|
|
|
|
|
|
catmandu drop ElasticSearch --index-name items --bag thingies |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |