From: Ian Jackson Date: Mon, 10 Aug 2020 10:27:11 +0000 (+0100) Subject: cr-publish-flight-logs: Make a proper option parser X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=88aeb87dc570be787455143188cf545868c26b88;p=osstest.git cr-publish-flight-logs: Make a proper option parser I was going to add another option but changed my mind. But, let's keep this patch anyway. Signed-off-by: Ian Jackson --- diff --git a/cr-publish-flight-logs b/cr-publish-flight-logs index faae7e0..717cb95 100755 --- a/cr-publish-flight-logs +++ b/cr-publish-flight-logs @@ -28,9 +28,14 @@ our %c; readglobalconfig(); my $push_harness = 0; -if (@ARGV && $ARGV[0] =~ m{^--push-harness(?:-try)?$}) { - $push_harness = $&; - shift @ARGV; +while (@ARGV && $ARGV[0] =~ m{^-}) { + $_ = shift @ARGV; + last if $_ eq '--'; + if (m{^--push-harness(?:-try)?$}) { + $push_harness = $&; + } else { + die "unknown option \`$_' ?"; + } } my $flight= shift @ARGV // '';