Bump version and update Changes
[gruntmaster-data.git] / lib / Gruntmaster / App / Command / Get.pm
CommitLineData
92f74061
MG
1package Gruntmaster::App::Command::Get;
2
3use 5.014000;
4use warnings;
5
e1b6fd19 6our $VERSION = '5999.000_014';
92f74061
MG
7
8use Gruntmaster::App '-command';
9use Gruntmaster::Data;
10
11sub usage_desc { '%c [-cjpu] get id column' }
12
13sub 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 != 2;
18}
19
20sub execute {
21 my ($self, $opt, $args) = @_;
22 my ($obj, $col) = @$args;
23 say db->select($self->app->table, $col, {id => $obj})->flat
24}
25
261;
27__END__
63afa40a
MG
28
29=encoding utf-8
30
31=head1 NAME
32
33Gruntmaster::App::Command::Get - get a property of an object
34
35=head1 SYNOPSIS
36
37 gm -u get MGV name
38 # Marius Gavrilescu
39
40 gm -p get aplusb level
41 # beginner
42
43 gm -c get test_ct description
44 # This is a <b>test</b> contest.<br>
45 # Nothing to see here.
46
47 gm -j get 100 result_text
48 # Accepted
49
50=head1 DESCRIPTION
51
52The get command takes two arguments: an object id and a property name,
53and returns the value of that property.
54
55=head1 SEE ALSO
56
57L<gm>
58
59=head1 AUTHOR
60
61Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
62
63=head1 COPYRIGHT AND LICENSE
64
e1b9f3dd 65Copyright (C) 2014-2015 by Marius Gavrilescu
63afa40a
MG
66
67This library is free software; you can redistribute it and/or modify
68it under the same terms as Perl itself, either Perl version 5.20.1 or,
69at your option, any later version of Perl 5 you may have available.
70
71
72=cut
This page took 0.014541 seconds and 4 git commands to generate.