| 1 | package Catmandu::Cmd::drop; | ||||||||||
| 2 | |||||||||||
| 3 | 13 | ▶ | use Catmandu::Sane; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 13 | our $VERSION = '1.0201_02'; | |||||||||
| 6 | |||||||||||
| 7 | 13 | ▶ | use parent 'Catmandu::Cmd'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 13 | ▶ | use Catmandu; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 13 | ▶ | use Catmandu::Util qw(check_able); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 13 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | sub command_opt_spec { | ||||||||||
| 13 | 0 | ▶ | (["bag=s", "drop a bag"],); | ||||||||
|
Subroutine
command_opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | sub command { | ||||||||||
| 17 | 0 | ▶ | my ($self, $opts, $args) = @_; | ||||||||
|
Subroutine
command: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 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 | ▶ | if ($opts->bag) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | check_able($from->bag($opts->bag), 'drop')->drop; | |||||||||
| 24 | } | ||||||||||
| 25 | else { | ||||||||||
| 26 | 0 | check_able($from, 'drop')->drop; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 13 | 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 | ||||||||||