diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-09-21 07:01:05 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-09-21 07:01:05 -0500 |
commit | 26b9790353908f811dbbc565ff35eec2f8b0f11f (patch) | |
tree | 9f01dc47a46fc9071b28024b157aab8ecf8df71b /sbofind | |
parent | 027d01c433b17b1914ba58fae90d6b422d4a45e7 (diff) | |
download | sbotools2-26b9790353908f811dbbc565ff35eec2f8b0f11f.tar.xz |
sbofind converted to long options and fixes added from 0.8
Diffstat (limited to 'sbofind')
-rwxr-xr-x | sbofind | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -14,7 +14,7 @@ use strict; use warnings FATAL => 'all'; use SBO::Lib; use File::Basename; -use Getopt::Std; +use Getopt::Long qw(:config bundling); my $self = basename ($0); @@ -23,10 +23,14 @@ sub show_usage () { Usage: $self (search_term) Options: - -h: this screen. - -v: version information. - -i: show the .info for each found item. - -r: show the README for each found item. + -h|--help: + this screen. + -v|--verison: + version information. + -i|--info: + show the .info for each found item. + -r|--readme: + show the README for each found item. Example: $self libsexy @@ -34,20 +38,23 @@ Example: EOF } -my %options; -getopts ('hvir', \%options); +my ($help, $vers, $show_info, $show_readme); -show_usage and exit 0 if exists $options{h}; -show_version and exit 0 if exists $options{v}; +GetOptions ( + 'help|h' => \$help, + 'version|v' => \$vers, + 'info|i' => \$show_info, + 'readme|r' => \$show_readme, +); -my $show_readme = exists $options{r} ? 1 : 0; -my $show_info = exists $options{i} ? 1 : 0; +show_usage and exit 0 if $help; +show_version and exit 0 if $vers; show_usage and exit 1 unless exists $ARGV[0]; my $search = $ARGV[0]; # if we can't find SLACKBUILDS.TXT in $config{HOME}, prompt to fetch the tree -slackbuilds_or_fetch; +slackbuilds_or_fetch; # find anything with $search in its name sub perform_search ($) { |