diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-04-16 17:21:28 +0200 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-04-16 17:21:28 +0200 |
commit | 0a035d36fb6a225640d31162e4b348dacfa93f96 (patch) | |
tree | e551ff0a6a8e0f20583b22a16213c5b708c3194b | |
parent | c1e7155333f1a86f90a7843e87bb1aa9145acdda (diff) | |
download | sbotools2-0a035d36fb6a225640d31162e4b348dacfa93f96.tar.xz |
Remove useless conditions from show_usage/version invocations
-rwxr-xr-x | sbocheck | 4 | ||||
-rwxr-xr-x | sboclean | 4 | ||||
-rwxr-xr-x | sboconfig | 4 | ||||
-rwxr-xr-x | sbofind | 6 | ||||
-rwxr-xr-x | sboinstall | 7 | ||||
-rwxr-xr-x | sboremove | 7 | ||||
-rwxr-xr-x | sbosnap | 11 | ||||
-rwxr-xr-x | sboupgrade | 7 |
8 files changed, 27 insertions, 23 deletions
@@ -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(); @@ -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); @@ -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', @@ -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 @@ -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; @@ -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; @@ -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() } @@ -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; |