X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=gruntmaster-contest;h=23fd515e84ef1c7af73bc44d4a819e2e51bc4db2;hb=4a8747effd02a1e0f9dde86b1c81f6c26ce66f04;hp=c2608c9300c26dcdb3915337fe13df12d076fbd4;hpb=014ee8a614839ded741f61979d979cdd4f20044c;p=gruntmaster-data.git diff --git a/gruntmaster-contest b/gruntmaster-contest index c2608c9..23fd515 100755 --- a/gruntmaster-contest +++ b/gruntmaster-contest @@ -9,6 +9,8 @@ use Date::Parse qw/str2time/; ################################################## +my $db = Gruntmaster::Data->connect('dbi:Pg:'); + sub cmd_help{ exec perldoc => $0 } @@ -19,11 +21,11 @@ sub cmd_list{ } sub cmd_show{ - local $_ = shift or goto &cmd_list; - say "Name: ", contest_name; - say "Owner: ", contest_owner; - say "Start: ", strftime '%c', localtime contest_start; - say "End: ", strftime '%c', localtime contest_end; +# local $_ = shift or goto &cmd_list; +# say "Name: ", contest_name; +# say "Owner: ", contest_owner; +# say "Start: ", strftime '%c', localtime contest_start; +# say "End: ", strftime '%c', localtime contest_end; } sub cmd_add{ @@ -31,16 +33,17 @@ sub cmd_add{ my $name = prompt 'Contest name'; my $owner = prompt 'Owner'; my $start = str2time prompt 'Start time' or die 'Cannot parse time'; - my $end = str2time prompt 'End time' or die 'Cannot parse time'; + my $stop = str2time prompt 'Stop time' or die 'Cannot parse time'; - insert_contest $id => name => $name, owner => $owner, start => $start, end => $end; - PUBLISH genpage => "ct/$id/index.html"; - PUBLISH genpage => "ct/index.html"; + $db->contests->create({id => $id, name => $name, owner => $owner, start => $start, stop => $stop}); +# insert_contest $id => name => $name, owner => $owner, start => $start, stop => $stop; +# PUBLISH genpage => "ct/$id/index.html"; +# PUBLISH genpage => "ct/index.html"; } sub cmd_rm{ - remove_contest shift; - PUBLISH genpage => "ct/index.html"; +# remove_contest shift; +# PUBLISH genpage => "ct/index.html"; } ################################################## @@ -68,6 +71,40 @@ gruntmaster-contest - shell interface to Gruntmaster 6000 contests =head1 DESCRIPTION +gruntmaster-contest is a tool for managing contests. + +=over + +=item B + +Prints the list of contests. + +=item B I + +Prints detailed information about the contest with id I. + +=item B I + +Adds a new contest with id I. + +=item B I + +Removes the contest with id I + +=back + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. =cut