mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 01:15:37 +08:00
Add package outputs, colorize motd
This commit is contained in:
@@ -23,6 +23,9 @@ abstract class Package
|
||||
/** @var array<string, callable> $build_functions Build functions for different OS binding */
|
||||
protected array $build_functions = [];
|
||||
|
||||
/** @var array<string, string> */
|
||||
protected array $outputs = [];
|
||||
|
||||
/**
|
||||
* @param string $name Name of the package
|
||||
* @param string $type Type of the package
|
||||
@@ -69,6 +72,17 @@ abstract class Package
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function setOutput(string $key, string $value): static
|
||||
{
|
||||
$this->outputs[$key] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOutputs(): array
|
||||
{
|
||||
return $this->outputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a build function for a specific platform.
|
||||
*
|
||||
|
||||
@@ -104,6 +104,16 @@ class PackageInstaller
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function printBuildPackageOutputs(): void
|
||||
{
|
||||
foreach ($this->build_packages as $package) {
|
||||
if (($outputs = $package->getOutputs()) !== []) {
|
||||
InteractiveTerm::notice('Package ' . ConsoleColor::green($package->getName()) . ' outputs');
|
||||
$this->printArrayInfo(info: $outputs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the package installation process.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user