From 88aeb87dc570be787455143188cf545868c26b88 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 10 Aug 2020 11:27:11 +0100 Subject: [PATCH] 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 --- 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 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 // ''; -- 2.39.5