use BEX;
my $edit;
+my $long;
my $queue_name;
sub usage() {
print <<AMEN ;
Usage: bex job [<options>] [<job-id>]
+If a job-id is given, print information on the given job.
+Otherwise, list all known jobs.
+
Options:
-e, --edit Run editor on the given job (no locking)
+-l, --long When listing jobs, use long format (with subjects)
-q, --queue=<name> Act on the given queue
AMEN
exit 0;
GetOptions(
"e|edit!" => \$edit,
+ "l|long!" => \$long,
"q|queue=s" => \$queue_name,
"help" => \&usage,
) && @ARGV <= 1 or die "Try `bex job --help' for more information.\n";
if (!@ARGV) {
my @jobs = $queue->all_job_ids;
- for (sort @jobs) {
- print $_, "\n";
+ for my $id (sort @jobs) {
+ if ($long) {
+ my $job = $queue->job_metadata($id);
+ my $has_att = -d $queue->attachment_dir($id);
+ print $job->name;
+ print " +ATT" if $has_att;
+ print "\n";
+ } else {
+ print $id, "\n";
+ }
}
exit 0;
}