diff mbox series

[OSSTEST,1/6] cr-publish-flight-logs: Make a proper option parser

Message ID 20200810112047.30285-1-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series [OSSTEST,1/6] cr-publish-flight-logs: Make a proper option parser | expand

Commit Message

Ian Jackson Aug. 10, 2020, 11:20 a.m. UTC
I was going to add another option but changed my mind.  But, let's
keep this patch anyway.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 cr-publish-flight-logs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/cr-publish-flight-logs b/cr-publish-flight-logs
index faae7e0e..717cb957 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 // '';