Correct install-pkg argument name, add alias

This commit is contained in:
crazywhalecc 2025-12-04 21:20:22 +08:00
parent 20892ab194
commit dc5bf6dc98
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -8,19 +8,19 @@ use StaticPHP\DI\ApplicationContext;
use StaticPHP\Package\PackageInstaller; use StaticPHP\Package\PackageInstaller;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand('install-pkg')] #[AsCommand('install-pkg', 'Install additional packages', ['i', 'install-package'])]
class InstallPackageCommand extends BaseCommand class InstallPackageCommand extends BaseCommand
{ {
public function configure() public function configure()
{ {
$this->addArgument('package', null, 'The package to install (name or path)'); $this->addArgument('packages', null, 'The package to install (name or path)');
} }
public function handle(): int public function handle(): int
{ {
ApplicationContext::set('elephant', true); ApplicationContext::set('elephant', true);
$installer = new PackageInstaller([...$this->input->getOptions(), 'dl-prefer-binary' => true]); $installer = new PackageInstaller([...$this->input->getOptions(), 'dl-prefer-binary' => true]);
$installer->addInstallPackage($this->input->getArgument('package')); $installer->addInstallPackage($this->input->getArgument('packages'));
$installer->run(true, true); $installer->run(true, true);
return static::SUCCESS; return static::SUCCESS;
} }