aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-04-16 17:21:28 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-04-16 17:21:28 +0200
commit0a035d36fb6a225640d31162e4b348dacfa93f96 (patch)
treee551ff0a6a8e0f20583b22a16213c5b708c3194b
parentc1e7155333f1a86f90a7843e87bb1aa9145acdda (diff)
downloadsbotools2-0a035d36fb6a225640d31162e4b348dacfa93f96.tar.xz
Remove useless conditions from show_usage/version invocations
-rwxr-xr-xsbocheck4
-rwxr-xr-xsboclean4
-rwxr-xr-xsboconfig4
-rwxr-xr-xsbofind6
-rwxr-xr-xsboinstall7
-rwxr-xr-xsboremove7
-rwxr-xr-xsbosnap11
-rwxr-xr-xsboupgrade7
8 files changed, 27 insertions, 23 deletions
diff --git a/sbocheck b/sbocheck
index e0c6518..3d3a29c 100755
--- a/sbocheck
+++ b/sbocheck
@@ -39,8 +39,8 @@ my ($help, $vers);
GetOptions('help|h' => \$help, 'version|v' => \$vers);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
update_tree();
diff --git a/sboclean b/sboclean
index fd3cf1f..851ab84 100755
--- a/sboclean
+++ b/sboclean
@@ -50,8 +50,8 @@ GetOptions(
'interactive|i' => \$interactive,
);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
usage_error("You must specify at least one of -d or -w.") unless
($clean_dist || $clean_work);
diff --git a/sboconfig b/sboconfig
index e9cd795..3088592 100755
--- a/sboconfig
+++ b/sboconfig
@@ -59,8 +59,8 @@ GetOptions(\%options, 'help|h', 'version|v', 'list|l', 'noclean|c=s',
'distclean|d=s', 'jobs|j=s', 'pkg-dir|p=s', 'sbo-home|s=s',
'local-overrides|o=s', 'slackware-version|V=s', 'repo|r=s');
-show_usage() and exit 0 if exists $options{help};
-show_version() and exit 0 if exists $options{version};
+if ($options{help}) { show_usage(); exit 0 }
+if ($options{version}) { show_version(); exit 0 }
my %valid_confs = (
noclean => 'NOCLEAN',
diff --git a/sbofind b/sbofind
index 8fd08f9..27e0066 100755
--- a/sbofind
+++ b/sbofind
@@ -52,10 +52,10 @@ GetOptions(
'queue|q' => \$show_queue,
);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
-show_usage() and exit 1 unless exists $ARGV[0];
+if (!@ARGV) { show_usage(); exit 1 }
my $search = $ARGV[0];
# if we can't find SLACKBUILDS.TXT in $config{HOME}, prompt to fetch the tree
diff --git a/sboinstall b/sboinstall
index ccd4683..9c5479e 100755
--- a/sboinstall
+++ b/sboinstall
@@ -64,9 +64,10 @@ GetOptions(
'norequirements|R' => \$no_reqs,
);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
-show_usage() and exit 1 unless exists $ARGV[0];
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
+
+if (!@ARGV) { show_usage(); exit 1 }
$noclean = $noclean eq 'TRUE' ? 1 : 0;
$distclean = $distclean eq 'TRUE' ? 1 : 0;
diff --git a/sboremove b/sboremove
index 05b560c..5b2420b 100755
--- a/sboremove
+++ b/sboremove
@@ -46,9 +46,10 @@ GetOptions(
'alwaysask|a' => \$alwaysask,
);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
-show_usage() and exit 1 unless exists $ARGV[0];
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
+
+if (!@ARGV) { show_usage(); exit 1 }
# ensure that all provided arguments are valid sbos
my @sbos;
diff --git a/sbosnap b/sbosnap
index e0876a5..1d835ab 100755
--- a/sbosnap
+++ b/sbosnap
@@ -39,21 +39,22 @@ EOF
return 1;
}
-show_usage() and exit 1 unless exists $ARGV[0];
-
my ($help, $vers);
GetOptions('help|h' => \$help, 'version|v' => \$vers);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
+
+if (!@ARGV) { show_usage(); exit 1 }
# check for a command and, if found, execute it
my $command;
if ($ARGV[0] =~ /fetch|update/) {
$command = $ARGV[0];
} else {
- show_usage() and exit 1;
+ show_usage();
+ exit 1;
}
if ($command eq 'fetch') { fetch_tree() }
diff --git a/sboupgrade b/sboupgrade
index e077511..c28819c 100755
--- a/sboupgrade
+++ b/sboupgrade
@@ -70,8 +70,8 @@ GetOptions(
'all' => \$all,
);
-show_usage() and exit 0 if $help;
-show_version() and exit 0 if $vers;
+if ($help) { show_usage(); exit 0 }
+if ($vers) { show_version(); exit 0 }
my $updates;
if ($all) {
@@ -79,9 +79,10 @@ if ($all) {
print "Checking for updated SlackBuilds...\n";
$updates = get_available_updates();
push @ARGV, map { $_->{name} } @$updates;
+ if (!@ARGV) { print "Nothing to update.\n"; exit 0 }
}
-show_usage() and exit 1 unless exists $ARGV[0];
+if (!@ARGV) { show_usage(); exit 1 }
$noclean = $noclean eq 'TRUE' ? 1 : 0;
$distclean = $distclean eq 'TRUE' ? 1 : 0;