mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
28 lines
806 B
PHP
28 lines
806 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace StaticPHP\Command;
|
|
|
|
use StaticPHP\DI\ApplicationContext;
|
|
use StaticPHP\Package\PackageInstaller;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
|
|
#[AsCommand('install-pkg', 'Install additional package', ['i', 'install-package'])]
|
|
class InstallPackageCommand extends BaseCommand
|
|
{
|
|
public function configure()
|
|
{
|
|
$this->addArgument('package', null, 'The package to install (name or path)');
|
|
}
|
|
|
|
public function handle(): int
|
|
{
|
|
ApplicationContext::set('elephant', true);
|
|
$installer = new PackageInstaller([...$this->input->getOptions(), 'dl-prefer-binary' => true]);
|
|
$installer->addInstallPackage($this->input->getArgument('package'));
|
|
$installer->run(true, true);
|
|
return static::SUCCESS;
|
|
}
|
|
}
|