#!/usr/bin/perl -w use v5.14; use Gruntmaster::Data; use IO::Prompter [ -style => 'bold', '-stdio', '-verbatim' ]; use POSIX qw/strftime/; ################################################## my $dsn = $ENV{GRUNTMASTER_DSN} // 'dbi:Pg:'; my $db = Gruntmaster::Data->connect($dsn); sub cmd_help{ exec perldoc => $0 } sub cmd_show{ my %columns = $db->job(shift)->get_columns; $columns{date} = strftime '%c', localtime $columns{date}; $columns{private} = $columns{private} ? 'yes' : 'no'; print <job(shift)->delete } sub cmd_get{ my ($id, $col) = @_; say $db->job($id)->get_column($col) } sub cmd_set{ my ($id, %values) = @_; $db->job($id)->update(\%values) } sub cmd_rerun{ $db->job(shift)->rerun } ################################################## my $cmd = 'cmd_' . shift; cmd_help unless exists $main::{$cmd}; no strict 'refs'; $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 show id gruntmaster-job rm id gruntmaster-job get id key gruntmaster-job set id key value gruntmaster-job rerun id =head1 DESCRIPTION gruntmaster-job is a tool for managing jobs. =over =item B I Prints detailed information about the job with id I. =item B I Removes the job with id I. =item B I I I Sets the I configuration option of job I to I. =item B I I Get the value of the I configuration option of job I. =item B I Reruns job 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 same terms as Perl itself, either Perl version 5.18.1 or, at your option, any later version of Perl 5 you may have available. =cut