From 2675d4f9232023b0c8b5c9e4778b2f192b06b4d5 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 21 Sep 2012 15:12:12 +0200 Subject: [PATCH] "bex help" is now equivalent to "bex --help" --- bex | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bex b/bex index b1cb7b0..f4db56f 100755 --- a/bex +++ b/bex @@ -9,12 +9,8 @@ use Getopt::Long; my $bex_home = $ENV{"BEX_HOME"} // "."; my $bex_lib = $ENV{"BEX_LIB"} // "lib"; -Getopt::Long::Configure('require_order'); -GetOptions( - "home=s" => \$bex_home, - "lib=s" => \$bex_lib, - "help" => sub { - print < General options: @@ -23,6 +19,7 @@ General options: Commands (and aliases): add (a) Add new jobs to a queue +help Show this help job Operations on queued jobs mach List known machines and groups prun (pr) Parallel version of `run' @@ -30,12 +27,18 @@ qman Management of queues queue (q) Show queues and jobs on them run (r) Run queued jobs AMEN - exit 0; - }, + exit 0; +} + +Getopt::Long::Configure('require_order'); +GetOptions( + "home=s" => \$bex_home, + "lib=s" => \$bex_lib, + "help" => \&show_help, "version" => sub { print "BEX 3.0 (c) 2011-2012 Martin Mares \n"; }, -) or die "Try `bex --help' for more information.\n"; +) or die "Try `bex help' for more information.\n"; Getopt::Long::Configure('default'); if (!-d $bex_home) { @@ -52,6 +55,8 @@ if (!-f "$bex_lib/perl/BEX.pm") { my $sub = shift @ARGV; $sub =~ /^[0-9a-zA-Z]+$/ or die "Invalid subcommand $sub\n"; +if ($sub eq 'help') { show_help(); } + my %aliases = ( 'a' => 'add', 'p' => 'prun', -- 2.39.2