Add package outputs, colorize motd

This commit is contained in:
crazywhalecc
2025-12-09 16:34:43 +08:00
parent ac01867e9c
commit b0f630f95f
8 changed files with 98 additions and 26 deletions

View File

@@ -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.
*

View File

@@ -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.
*/