X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bex;h=f4db56f0fe90b25751ece0ef953eb50cfa3f3caa;hb=92c7cf64ce0af77c4fe9a4de8fb466c71119a970;hp=02084e02d0e305595ea4179427b7e5317ea3a1c9;hpb=e714edbb2b247daf3195be0361765b9e7cf53c01;p=bex.git diff --git a/bex b/bex index 02084e0..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,18 +19,26 @@ General options: Commands (and aliases): add (a) Add new jobs to a queue +help Show this help job Operations on queued jobs -ls List known machines and groups +mach List known machines and groups prun (pr) Parallel version of `run' -queue (q) Show queues and jobs +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) { @@ -51,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', @@ -59,7 +65,7 @@ my %aliases = ( ); if (defined $aliases{$sub}) { $sub = $aliases{$sub}; } -my $sub_path = "$bex_lib/bin/$sub"; +my $sub_path = "$bex_lib/bin/bex-$sub"; -x $sub_path or die "Unknown subcommand $sub\n"; $ENV{"BEX_HOME"} = $bex_home;