]>
Commit | Line | Data |
---|---|---|
83a8a7d6 MG |
1 | #!/usr/bin/perl -w |
2 | use v5.14; | |
3 | ||
4 | use Gruntmaster::Data qw/jobcard job_date job_user job_problem job_filesize job_private job_result_text job_daemon clean_job problem_name PUBLISH HDEL/; | |
5 | ||
6 | use IO::Prompter [ -style => 'bold', '-stdio', '-verbatim' ]; | |
7 | use File::Slurp qw/read_file/; | |
8 | use Term::ANSIColor qw/RED RESET/; | |
9 | use POSIX qw/strftime/; | |
10 | ||
11 | ################################################## | |
12 | ||
13 | sub cmd_help{ | |
14 | exec perldoc => $0 | |
15 | } | |
16 | ||
17 | sub cmd_card{ | |
18 | my $contest = shift; | |
19 | print jobcard; | |
20 | } | |
21 | ||
22 | sub cmd_show{ | |
23 | local $_ = shift or goto &cmd_list; | |
24 | say "Date: " , strftime ('%c', localtime job_date); | |
25 | say "User: ", job_user; | |
26 | say "Problem: ", problem_name job_problem; | |
27 | say "Size: ", sprintf "%.2fKB", job_filesize() / 1024; | |
28 | say "Private: ", (job_private() ? 'yes' : 'no'); | |
29 | say "Result text: ", job_result_text; | |
30 | say "Daemon: ", job_daemon; | |
31 | } | |
32 | ||
33 | sub cmd_rerun{ | |
34 | local $_ = shift or goto &cmd_list; | |
35 | clean_job; | |
36 | PUBLISH jobs => $_; | |
37 | } | |
38 | ||
39 | ################################################## | |
40 | ||
41 | no strict 'refs'; | |
42 | my $cmd = 'cmd_' . shift; | |
43 | cmd_help unless exists $main::{$cmd}; | |
44 | $cmd->(@ARGV) if exists $main::{$cmd}; | |
45 | ||
46 | 1; | |
47 | __END__ | |
48 | ||
49 | =encoding utf-8 | |
50 | ||
51 | =head1 NAME | |
52 | ||
53 | gruntmaster-job - shell interface to Gruntmaster 6000 job log | |
54 | ||
55 | =head1 SYNOPSIS | |
56 | ||
57 | gruntmaster-job card | |
58 | gruntmaster-job show 5 | |
59 | gruntmaster-job rerun 7 | |
60 | ||
61 | =head1 DESCRIPTION | |
62 | ||
63 | ||
64 | ||
65 | =cut |