From: Fredrik Tolf Date: Thu, 10 Mar 2011 18:12:04 +0000 (+0100) Subject: anndata: Added option for browsing to the current directory's name. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=e5f1f6aa4366b045a555bb4b50f83f4cd9fd7ae5;hp=2dcf548661ac398e823bd4062bd8233aca863500;p=utils.git anndata: Added option for browsing to the current directory's name. --- diff --git a/anndata b/anndata index 5a91e5a..7ed3e13 100755 --- a/anndata +++ b/anndata @@ -4,7 +4,7 @@ use Getopt::Long; use Anime::ANN; binmode STDOUT, ":utf8"; -GetOptions(\%options, "l=s", "b=s") || exit 1; +GetOptions(\%options, "l=s", "b=s", "d") || exit 1; if($options{"l"}) { @list = Anime::ANN::getlist($options{"l"}); @@ -14,12 +14,18 @@ if($options{"l"}) { exit 0; } +$browse = ""; if($options{"b"}) { - $id = Anime::ANN::getid $options{"b"}; + $browse = $options{"b"}; +} elsif($options{"d"}) { + $browse = `basename "\$(pwd)"`; +} +if($browse) { + $id = Anime::ANN::getid $browse; if(defined($id)) { exec "htmlview", Anime::ANN::geturl($id); } else { - printf STDERR "could not find " . $options{"b"} . "\n"; + printf STDERR "could not find " . $browse . "\n"; exit 1; } }