sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit 3591a89dbc5229de9659cbb8626ee82ca34c089b
parent 37ded00a44421d02df657314efbe3a131f6916ff
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Mon, 18 Apr 2016 00:01:42 +0200

sbosnap: Make argument checking more streamlined

Diffstat:
Msbosnap | 16+++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/sbosnap b/sbosnap @@ -46,18 +46,16 @@ GetOptions('help|h' => \$help, 'version|v' => \$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 { +$ARGV[0] //= ''; + +if ($ARGV[0] eq 'fetch') { + fetch_tree() +} elsif ($ARGV[0] eq 'update') { + update_tree() +} else { show_usage(); exit 1; } -if ($command eq 'fetch') { fetch_tree() } -elsif ($command eq 'update') { update_tree() } - exit 0;