Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Utzinger committed Jun 1, 2024
1 parent d2d0178 commit a066072
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/Commands/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,23 @@ public function handle(): void
);
}

// Default params to "build:all" command
$arch = '';
$publish = 'build';
if ($os != 'all') {
// Depends on the currenty available php executables
if (! $arch = $this->argument('arch')) {
$availOsArch = [
'win' => ['-x64'],
'mac' => ['-x86', '-arm', 'all'],
'linux' => ['-x64']
];
$arch = select(
label: 'Please select Processor Architecture',
options: $availOsArch[$os],
default: $availOsArch[$os][0]
options: ($a = $this->getArchForOs($os)),
default: $a[0]
);
if ($arch == 'all') {
$arch = '';
}
}

// Wether to publish the app or not
if (! $publish = $this->argument('pub')) {
$publish = confirm(
label: 'Should the App be published?',
Expand Down Expand Up @@ -111,4 +110,12 @@ protected function getDefaultOs(): string
default => 'all',
};
}

protected function getArchForOs(string $os): array {
return match ($os) {
'win' => ['-x64'],
'mac' => ['-x86', '-arm', 'all'],
'linux' => ['-x64']
};
}
}

0 comments on commit a066072

Please sign in to comment.