Bump version and update Changes
[gruntmaster-data.git] / lib / Gruntmaster / App / Command / Rm.pm
1 package Gruntmaster::App::Command::Rm;
2
3 use 5.014000;
4 use warnings;
5
6 our $VERSION = '5999.000_014';
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__
28
29 =encoding utf-8
30
31 =head1 NAME
32
33 Gruntmaster::App::Command::Rm - remove an object
34
35 =head1 SYNOPSIS
36
37 gm -c rm test_contest
38 gm -p rm aplusb
39 gm -j rm 10
40 gm -u rm MGV
41
42 =head1 DESCRIPTION
43
44 The rm command takes the ID of an object and removes it.
45
46 =head1 SEE ALSO
47
48 L<gm>
49
50 =head1 AUTHOR
51
52 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
53
54 =head1 COPYRIGHT AND LICENSE
55
56 Copyright (C) 2014-2015 by Marius Gavrilescu
57
58 This library is free software; you can redistribute it and/or modify
59 it under the same terms as Perl itself, either Perl version 5.20.1 or,
60 at your option, any later version of Perl 5 you may have available.
61
62
63 =cut
This page took 0.023588 seconds and 4 git commands to generate.