]>
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 $db = Gruntmaster
::Data
->connect('dbi:Pg:');
20 say map { $_->id } $db->contests->all;
24 my %columns = $db->contest(shift)->get_columns;
25 $columns{$_} = strftime
'%c', localtime $columns{$_} for qw
/start stop/;
28 Owner: $columns{owner}
29 Start: $columns{start}
36 my $name = prompt
'Contest name';
37 my $owner = prompt
'Owner';
38 my $start = str2time prompt
'Start time' or die 'Cannot parse time';
39 my $stop = str2time prompt
'Stop time' or die 'Cannot parse time';
41 $db->contests->create({id
=> $id, name
=> $name, owner
=> $owner, start
=> $start, stop
=> $stop})
45 $db->contest(shift)->delete
50 say $db->contest($id)->get_column($col)
54 my ($id, %values) = @_;
55 $db->contest($id)->update(\
%values)
58 ##################################################
61 my $cmd = 'cmd_' . shift;
62 cmd_help
unless exists $main::{$cmd};
63 $cmd->(@ARGV) if exists $main::{$cmd};
72 gruntmaster-contest - shell interface to Gruntmaster 6000 contests
76 gruntmaster-contest list
77 gruntmaster-contest show id
78 gruntmaster-contest add id
79 gruntmaster-contest rm id
80 gruntmaster-contest get id key
81 gruntmaster-contest set id key value
85 gruntmaster-contest is a tool for managing contests.
91 Prints the list of contests.
95 Prints detailed information about the contest with id I<id>.
99 Adds a new contest with id I<id>.
103 Removes the contest with id I<id>.
105 =item B<set> I<id> I<key> I<value>
107 Sets the I<key> configuration option of contest I<id> to I<value>.
109 =item B<get> I<id> I<key>
111 Get the value of the I<key> configuration option of contest I<id>.
117 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
119 =head1 COPYRIGHT AND LICENSE
121 Copyright (C) 2014 by Marius Gavrilescu
123 This library is free software; you can redistribute it and/or modify
124 it under the same terms as Perl itself, either Perl version 5.18.1 or,
125 at your option, any later version of Perl 5 you may have available.
This page took 0.056672 seconds and 5 git commands to generate.