#!/usr/bin/perl -w use v5.14; 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/; use IO::Prompter [ -style => 'bold', '-stdio', '-verbatim' ]; use File::Slurp qw/read_file/; use Term::ANSIColor qw/RED RESET/; use POSIX qw/strftime/; ################################################## sub cmd_help{ exec perldoc => $0 } sub cmd_card{ my $contest = shift; print jobcard; } sub cmd_show{ local $_ = shift or goto &cmd_list; say "Date: " , strftime ('%c', localtime job_date); say "User: ", job_user; say "Problem: ", problem_name job_problem; say "Size: ", sprintf "%.2fKB", job_filesize() / 1024; say "Private: ", (job_private() ? 'yes' : 'no'); say "Result text: ", job_result_text; say "Daemon: ", job_daemon; } sub cmd_rerun{ local $_ = shift or goto &cmd_list; clean_job; PUBLISH jobs => $_; } ################################################## no strict 'refs'; my $cmd = 'cmd_' . shift; cmd_help unless exists $main::{$cmd}; $cmd->(@ARGV) if exists $main::{$cmd}; 1; __END__ =encoding utf-8 =head1 NAME gruntmaster-job - shell interface to Gruntmaster 6000 job log =head1 SYNOPSIS gruntmaster-job card gruntmaster-job show 5 gruntmaster-job rerun 7 =head1 DESCRIPTION =cut