]> mj.ucw.cz Git - bex.git/blob - lib/bin/job
Updated command usage
[bex.git] / lib / bin / job
1 #!/usr/bin/perl
2 # Batch EXecutor 3.0 -- Operations on a Job
3 # (c) 2011-2012 Martin Mares <mj@ucw.cz>
4
5 use strict;
6 use warnings;
7 use Getopt::Long;
8 use BEX;
9
10 my $edit;
11 my $queue_name;
12
13 GetOptions(
14         "e|edit!" => \$edit,
15         "q|queue=s" => \$queue_name,
16 ) && @ARGV == 1 or die <<AMEN ;
17 Usage: bex job [<options>] <job-id>
18
19 Options:
20 -e, --edit              Run editor on the given job (no locking)
21 -q, --queue=<name>      Act on the given queue
22 AMEN
23
24 my $queue = BEX::Queue->new($queue_name);
25 my $fn = $queue->job_file($ARGV[0]);
26 -f $fn or die "No such job " . $ARGV[0] . "\n";
27
28 if ($edit) {
29         system "editor", $fn;
30 } else {
31         system "cat", $fn;
32 }