]>
Commit | Line | Data |
---|---|---|
92f74061 MG |
1 | package Gruntmaster::App::Command::List; |
2 | ||
3 | use 5.014000; | |
4 | use warnings; | |
5 | ||
b35cbc0d | 6 | our $VERSION = '5999.000_016'; |
92f74061 MG |
7 | |
8 | use Gruntmaster::App '-command'; | |
9 | use Gruntmaster::Data; | |
10 | ||
11 | sub usage_desc { '%c [-cjpu] list' } | |
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 | } | |
18 | ||
19 | sub execute { | |
20 | my ($self, $opt, $args) = @_; | |
21 | say join "\n", db->select($self->app->table, 'id', {}, 'id')->flat | |
22 | } | |
23 | ||
24 | 1; | |
25 | __END__ | |
63afa40a MG |
26 | |
27 | =encoding utf-8 | |
28 | ||
29 | =head1 NAME | |
30 | ||
31 | Gruntmaster::App::Command::List - list all objects of a type | |
32 | ||
33 | =head1 SYNOPSIS | |
34 | ||
35 | gm -c list | |
36 | # test_contest | |
37 | # some_other_contest | |
38 | ||
39 | gm -j list # This is pretty pointless | |
40 | # 1 | |
41 | # 2 | |
42 | # 3 | |
43 | ||
44 | gm -p list | |
45 | # aplusb | |
46 | # aminusb | |
47 | ||
48 | gm -u list | |
49 | # MGV | |
50 | # nobody | |
51 | ||
52 | =head1 DESCRIPTION | |
53 | ||
54 | The list command lists the IDs of all objects of a type, one per line. | |
55 | The list is sorted. | |
56 | ||
57 | =head1 SEE ALSO | |
58 | ||
59 | L<gm> | |
60 | ||
61 | =head1 AUTHOR | |
62 | ||
63 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> | |
64 | ||
65 | =head1 COPYRIGHT AND LICENSE | |
66 | ||
b35cbc0d | 67 | Copyright (C) 2014-2016 by Marius Gavrilescu |
63afa40a MG |
68 | |
69 | This library is free software; you can redistribute it and/or modify | |
70 | it under the same terms as Perl itself, either Perl version 5.20.1 or, | |
71 | at your option, any later version of Perl 5 you may have available. | |
72 | ||
73 | ||
74 | =cut |