my $given_subject;
my $given_template;
-GetOptions(
- "b|body=s" => \$given_body,
- "g|go!" => \$given_go,
- "i|id=s" => \$given_id,
- "q|queue=s" => \$queue_name,
- "r|requeue=s" => \$requeue_id,
- "s|subject=s" => \$given_subject,
- "t|template=s" => \$given_template,
-) or die <<AMEN ;
+sub usage() {
+ print <<AMEN ;
Usage: bex add [<options>] [!]<machine-or-class> ...
Options:
-s, --subject=<subj> Set subject of the new job
-t, --template=<file> Load job template (headers and body) from the given file
AMEN
+ exit 0;
+}
+
+GetOptions(
+ "b|body=s" => \$given_body,
+ "g|go!" => \$given_go,
+ "i|id=s" => \$given_id,
+ "q|queue=s" => \$queue_name,
+ "r|requeue=s" => \$requeue_id,
+ "s|subject=s" => \$given_subject,
+ "t|template=s" => \$given_template,
+ "help" => \&usage,
+) or die "Try `bex add --help' for more information.\n";
# Prepare machine set
@ARGV or die "No machines specified\n";
my $edit;
my $queue_name;
-GetOptions(
- "e|edit!" => \$edit,
- "q|queue=s" => \$queue_name,
-) && @ARGV == 1 or die <<AMEN ;
+sub usage() {
+ print <<AMEN ;
Usage: bex job [<options>] <job-id>
Options:
-e, --edit Run editor on the given job (no locking)
-q, --queue=<name> Act on the given queue
AMEN
+ exit 0;
+}
+
+GetOptions(
+ "e|edit!" => \$edit,
+ "q|queue=s" => \$queue_name,
+ "help" => \&usage,
+) && @ARGV == 1 or die "Try `bex job --help' for more information.\n";
my $queue = BEX::Queue->new($queue_name);
my $fn = $queue->job_file($ARGV[0]);
my $queue_name;
my $given_job;
-GetOptions(
- "by-job!" => \$op_by_job,
- "h|by-host!" => \$op_by_host,
- "rm!" => \$op_rm,
- "move-to=s" => \$op_move_to,
- "j|job=s" => \$given_job,
- "q|queue=s" => \$queue_name,
-) or die <<AMEN ;
+sub usage() {
+ print <<AMEN ;
Usage: bex ls [<options and actions>] [[!]<machine-or-class> ...]
Actions:
-j, --job=<id> Act on the specified job (default: on all)
-q, --queue=<name> Act on the given queue
AMEN
+ exit 0;
+}
+
+GetOptions(
+ "by-job!" => \$op_by_job,
+ "h|by-host!" => \$op_by_host,
+ "rm!" => \$op_rm,
+ "move-to=s" => \$op_move_to,
+ "j|job=s" => \$given_job,
+ "q|queue=s" => \$queue_name,
+ "help" => \&usage,
+) or die "Try `bex ls --help' for more information.\n";
my @machines = BEX::Config::parse_machine_list(@ARGV ? @ARGV : '*');
my $queue = BEX::Queue->new($queue_name);
my $edit;
my $queue_name;
-GetOptions(
-) && @ARGV == 0 or die <<AMEN ;
+sub usage() {
+ print <<AMEN ;
Usage: bex mach [<options>]
Options:
None defined so far.
AMEN
+ exit 0;
+}
+
+GetOptions(
+ "help" => \&usage,
+) && @ARGV == 0 or die "Try `bex mach --help' for more information.\n";
my $machines = \%BEX::Config::machines;
my $screen_session = 'BEX';
my $text_mode;
-GetOptions(
- "q|queue=s" => \$queue_name,
- "session=s" => \$screen_session,
- "text!" => \$text_mode,
-) or die <<AMEN ;
+sub usage() {
+ print <<AMEN ;
Usage: bex prun [<options>] [[!]<machine-or-class> ...]
Options:
session (default: BEX)
--text Use textual user interface instead of curses
AMEN
+ exit 0;
+}
+
+GetOptions(
+ "q|queue=s" => \$queue_name,
+ "session=s" => \$screen_session,
+ "text!" => \$text_mode,
+ "help" => \&usage,
+) or die "Try `bex prun --help' for more information.\n";
system 'screen', '-S', $screen_session, '-X', 'select', '.';
!$? or die "Screen session $screen_session not found\n";
my $init;
-GetOptions(
- "init!" => \$init,
-) or die <<AMEN ;
+sub usage() {
+ print <<AMEN ;
Usage: bex queue [<options>] <subcommand>
Subcommands:
Options:
None defined so far.
AMEN
+ exit 0;
+}
+
+GetOptions(
+ "init!" => \$init,
+ "help" => \&usage,
+) or die "Try `bex queue --help' for more information.\n";
my $op = shift @ARGV // 'ls';
use Getopt::Long;
use BEX;
+sub usage() {
+ print <<AMEN ;
+Usage: bex run [<options>] [[!]<machine-or-class> ...]
+
+Options:
+-j, --job=<id> Run only the specified job
+-q, --queue=<name> Select job queue
+ --status-fifo=<f> Send status updates to the given named pipe
+AMEN
+ exit 0;
+}
+
my $given_job;
my $queue_name;
my $status_fifo;
"j|job=s" => \$given_job,
"q|queue=s" => \$queue_name,
"s|status-fifo=s" => \$status_fifo,
-) or die <<AMEN ;
-Usage: bex run [<options>] [[!]<machine-or-class> ...]
-
-Options:
--j, --job=<id> Run only the specified job
--q, --queue=<name> Select job queue
- --status-fifo=<f> Send status updates to the given named pipe
-AMEN
+ "help" => \&usage,
+) or die "Try `bex run --help' for more information.\n";
my $status_fd;
if (defined $status_fifo) {