aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ Pipkin <j@dawnrazor.net>2012-09-08 12:51:08 -0500
committerJ Pipkin <j@dawnrazor.net>2012-09-08 12:51:08 -0500
commit5c029fef2d700afbcc72cac03b6a8b956b2fcc80 (patch)
tree48cccb4a5fdaa3b855f58654d1e6129b3e9a37de
parentec9042d5a06073dfe698099b455da3192e2f7783 (diff)
downloadsbotools2-5c029fef2d700afbcc72cac03b6a8b956b2fcc80.tar.xz
sboclean converted to Getopt::Long
-rwxr-xr-xsboclean20
1 files changed, 12 insertions, 8 deletions
diff --git a/sboclean b/sboclean
index fef857f..3769fc9 100755
--- a/sboclean
+++ b/sboclean
@@ -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);
use File::Path qw(remove_tree);
my $self = basename ($0);
@@ -33,14 +33,18 @@ Options:
EOF
}
-my %options;
-getopts ('hvdwi', \%options);
+my ($help, $vers, $clean_dist, $clean_work, $interactive);
-show_usage && exit 0 if exists $options{h};
-show_version && exit 0 if exists $options{v};
-my $clean_dist = exists $options{d} ? 1 : 0;
-my $clean_work = exists $options{w} ? 1 : 0;
-my $interactive = exists $options{i} ? 1 : 0;
+GetOptions (
+ 'help|h' => \$help,
+ 'version|v' => \$vers,
+ 'clean-dist|d' => \$clean_dist,
+ 'clean-work|w' => \$clean_work,
+ 'interactive|i' => \$interactiv,
+);
+
+show_usage && exit 0 if $help;
+show_version && exit 0 if $vers;
unless ($clean_dist || $clean_work) {
show_usage, die "You must specify at least one of -d or -w.\n";