]> mj.ucw.cz Git - bex.git/commitdiff
All commands now have normal --help
authorMartin Mares <mj@ucw.cz>
Wed, 15 Feb 2012 22:56:48 +0000 (23:56 +0100)
committerMartin Mares <mj@ucw.cz>
Wed, 15 Feb 2012 22:56:48 +0000 (23:56 +0100)
lib/bin/add
lib/bin/job
lib/bin/ls
lib/bin/mach
lib/bin/prun
lib/bin/queue
lib/bin/run

index 7483ea806a07c42a73de9aeb0016ec80e41e947e..64945f95db36305b33da11ed1118d8aa3bf05e55 100755 (executable)
@@ -16,15 +16,8 @@ my $requeue_id;
 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:
@@ -36,6 +29,19 @@ 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";
index 11e8e116dcf54847325f44b3ab5c7b5fe9bc5dd9..48f98a809dacdee5803c598893834c8dd92b0bd4 100755 (executable)
@@ -10,16 +10,22 @@ use BEX;
 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]);
index 79db5139378400e8471f2eb5f95dd9d4227384bd..a57598365fb148a253d1be9340a9714e74dd1274 100755 (executable)
@@ -16,14 +16,8 @@ my $op_move_to;
 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:
@@ -36,6 +30,18 @@ Options:
 -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);
index 69c26c6c8335a2925f981a365aab84a948e98778..e63f1803b5090b2c0bad7357640b48135117bb80 100755 (executable)
@@ -10,13 +10,19 @@ use BEX;
 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;
 
index ba17cd41d169310aefe4508a106ae58ba783e863..4900ef24db5b6bb8bf3fd0e6f766ca823dc31a05 100755 (executable)
@@ -13,11 +13,8 @@ my $queue_name;
 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:
@@ -26,6 +23,15 @@ 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";
index 1ebca3a388055373f4c79225343768d542620f70..aa90755a64981b07e5b08dd0753e5ba9d09cb9c9 100755 (executable)
@@ -9,9 +9,8 @@ use BEX;
 
 my $init;
 
-GetOptions(
-       "init!" => \$init,
-) or die <<AMEN ;
+sub usage() {
+       print <<AMEN ;
 Usage: bex queue [<options>] <subcommand>
 
 Subcommands:
@@ -21,6 +20,13 @@ ls           List all queues
 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';
 
index f90c96f78ffa34b9336e632852c3034f2c33af35..66b9efc89ed0f829041ae92b9bb5400b4d315e79 100755 (executable)
@@ -7,6 +7,18 @@ use warnings;
 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;
@@ -15,14 +27,8 @@ GetOptions(
        "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) {