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.
This commit is contained in:
Lukas Ruzicka 2023-08-15 15:09:42 +02:00
parent 30af56635a
commit 0b6c451b3a
1 changed files with 16 additions and 3 deletions

19
bis.pl
View File

@ -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");