[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 1/6] 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 <ian.jackson@xxxxxxxxxxxxx>
---
 cr-publish-flight-logs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

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 // '';
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.