File Coverage

blib/lib/Catmandu/Cmd/drop.pm
Criterion Covered Total %
statement 15 22 68.1
branch 0 2 0.0
condition n/a
subroutine 5 7 71.4
pod 2 2 100.0
total 22 33 66.6


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