From 0b6c451b3ae1924b948d3dc8763cc1af5474efa5 Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Tue, 15 Aug 2023 15:09:42 +0200 Subject: [PATCH] Rewrite the CLI parsing Now, it is possible to use named arguments for $architecture (-a), $variant (-t) and $videomode (-m). When $architecture and $videomode are omitted, x86_64 and full video mode are considered. --- bis.pl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/bis.pl b/bis.pl index f61c7951..60471a2c 100755 --- a/bis.pl +++ b/bis.pl @@ -6,12 +6,25 @@ use REST::Client; use JSON::XS; use Data::Dumper; -my ($variant, $architecture) = @ARGV; +my %cli = @ARGV; +my $variant = $cli{-t}; +my ($architecture, $videomode); # When no architecture is given, fall back to x86_64. -unless ($architecture) { +unless ($cli{-a}) { $architecture = "x86_64"; } +else { + $architecture = $cli{-a}; +} + +# When BASIC is not defined, fall back to NON-BASIC +unless ($cli{-m}) { + $videomode = "full"; +} +else { + $videomode = $cli{-m}; +} my $netinst = ""; $variant = ucfirst($variant); @@ -53,7 +66,7 @@ if ($variant eq "Server") { print("Sending the API command to openQA: \n"); -my $command = "openqa-cli api -X POST isos DISTRI=fedora VERSION=Rawhide FLAVOR=PiKVM ARCH=$architecture BUILD=Bare_install_$variant DOWNLOAD=$isolink SUBVARIANT=$variant"; +my $command = "openqa-cli api -X POST isos DISTRI=fedora VERSION=Rawhide FLAVOR=PiKVM ARCH=$architecture BUILD=Bare_install_$variant DOWNLOAD=$isolink SUBVARIANT=$variant VIDEOMODE=$videomode"; print(" $command\n");