Update schema
[gruntmaster-data.git] / gruntmaster-job
CommitLineData
014ee8a6
MG
1#!/usr/bin/perl -w
2use v5.14;
3
4use Gruntmaster::Data;
5
6use IO::Prompter [ -style => 'bold', '-stdio', '-verbatim' ];
7use File::Slurp qw/read_file/;
8use Getopt::Long;
9use Term::ANSIColor qw/RED RESET/;
10use POSIX qw/strftime/;
11
12##################################################
13
14my $contest;
15
16sub cmd_help{
17 exec perldoc => $0
18}
19
20sub cmd_card{
21 say jobcard;
22}
23
24sub cmd_show{
25 local $_ = shift or goto &cmd_list;
26 say "Date: " , strftime ('%c', localtime job_date);
27 say "User: ", job_user;
28 say "Problem: ", problem_name job_problem;
29 say "Extension: ", job_extension;
30 say "Size: ", sprintf "%.2fKB", job_filesize() / 1024;
31 say "Private: ", (job_private() ? 'yes' : 'no');
32 say "Result text: ", job_result_text;
33 say "Daemon: ", job_daemon;
34 say "Compile errors: ", job_errors;
35}
36
37sub cmd_rerun{
38 local $_ = shift or goto &cmd_list;
39 clean_job;
40 $contest//='';
41 PUBLISH jobs => "$contest.$_";
42}
43
44##################################################
45
46GetOptions ( 'contest=s' => \$contest );
47local $Gruntmaster::Data::contest = $contest;
48my $cmd = 'cmd_' . shift;
49cmd_help unless exists $main::{$cmd};
50no strict 'refs';
51$cmd->(@ARGV) if exists $main::{$cmd};
52
531;
54__END__
55
56=encoding utf-8
57
58=head1 NAME
59
60gruntmaster-job - shell interface to Gruntmaster 6000 job log
61
62=head1 SYNOPSIS
63
e90402be
MG
64 gruntmaster-job [--contest=mycontest] card
65 gruntmaster-job [--contest=mycontest] show 5
66 gruntmaster-job [--contest=mycontest] rerun 7
014ee8a6
MG
67
68=head1 DESCRIPTION
69
e90402be
MG
70gruntmaster-job is a tool for managing jobs.
71
72Select the contest with the optional argument I<--contest>.
73
74=over
75
76=item B<card>
77
78Prints the number of jobs in the selected contest.
79
80=item B<show> I<id>
81
82Prints detailed information about the job with id I<id>.
83
84=item B<rerun> I<id>
85
86Reruns job I<id>.
87
88=back
89
90=head1 AUTHOR
91
92Marius Gavrilescu E<lt>marius@ieval.roE<gt>
93
94=head1 COPYRIGHT AND LICENSE
95
96Copyright (C) 2014 by Marius Gavrilescu
97
98This library is free software: you can redistribute it and/or modify
99it under the terms of the GNU Affero General Public License as published by
100the Free Software Foundation, either version 3 of the License, or
101(at your option) any later version.
014ee8a6
MG
102
103
104=cut
This page took 0.013827 seconds and 4 git commands to generate.