]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::App::Command::Rm; | |
2 | ||
3 | use 5.014000; | |
4 | use warnings; | |
5 | ||
6 | our $VERSION = '5999.000_004'; | |
7 | ||
8 | use Gruntmaster::App '-command'; | |
9 | use Gruntmaster::Data; | |
10 | ||
11 | sub usage_desc { '%c [-cjpu] rm id' } | |
12 | ||
13 | sub validate_args { | |
14 | my ($self, $opt, $args) = @_; | |
15 | my @args = @$args; | |
16 | $self->usage_error('No table selected') unless $self->app->table; | |
17 | $self->usage_error('Wrong number of arguments') if @args != 1; | |
18 | } | |
19 | ||
20 | sub execute { | |
21 | my ($self, $opt, $args) = @_; | |
22 | my ($obj) = @$args; | |
23 | say 'Rows deleted: ', db->delete($self->app->table, {id => $obj})->rows | |
24 | } | |
25 | ||
26 | 1; | |
27 | __END__ |