]>
iEval git - gruntmaster-data.git/blob - gruntmaster-contest
6 use IO
::Prompter
[ -style
=> 'bold', '-stdio', '-verbatim' ];
7 use POSIX qw
/strftime/;
8 use Date
::Parse qw
/str2time/;
10 ##################################################
12 my $dsn = $ENV{GRUNTMASTER_DSN
} // 'dbi:Pg:';
13 my $db = Gruntmaster
::Data
->connect($dsn);
21 say map { $_->id } $db->contests->all;
25 my %columns = $db->contest(shift)->get_columns;
26 $columns{$_} = strftime
'%c', localtime $columns{$_} for qw
/start stop/;
29 Owner: $columns{owner}
30 Start: $columns{start}
37 my $name = prompt
'Contest name';
38 my $owner = prompt
'Owner';
39 my $start = str2time prompt
'Start time' or die 'Cannot parse time';
40 my $stop = str2time prompt
'Stop time' or die 'Cannot parse time';
42 $db->contests->create({id
=> $id, name
=> $name, owner
=> $owner, start
=> $start, stop
=> $stop})
46 $db->contest(shift)->delete
51 say $db->contest($id)->get_column($col)
55 my ($id, %values) = @_;
56 $db->contest($id)->update(\
%values)
59 ##################################################
62 my $cmd = 'cmd_' . shift;
63 cmd_help
unless exists $main::{$cmd};
64 $cmd->(@ARGV) if exists $main::{$cmd};
73 gruntmaster-contest - shell interface to Gruntmaster 6000 contests
77 gruntmaster-contest list
78 gruntmaster-contest show id
79 gruntmaster-contest add id
80 gruntmaster-contest rm id
81 gruntmaster-contest get id key
82 gruntmaster-contest set id key value
86 gruntmaster-contest is a tool for managing contests.
92 Prints the list of contests.
96 Prints detailed information about the contest with id I<id>.
100 Adds a new contest with id I<id>.
104 Removes the contest with id I<id>.
106 =item B<set> I<id> I<key> I<value>
108 Sets the I<key> configuration option of contest I<id> to I<value>.
110 =item B<get> I<id> I<key>
112 Get the value of the I<key> configuration option of contest I<id>.
118 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
120 =head1 COPYRIGHT AND LICENSE
122 Copyright (C) 2014 by Marius Gavrilescu
124 This library is free software; you can redistribute it and/or modify
125 it under the same terms as Perl itself, either Perl version 5.18.1 or,
126 at your option, any later version of Perl 5 you may have available.
This page took 0.062974 seconds and 5 git commands to generate.