mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
add dev commands
This commit is contained in:
parent
cbc3adbec0
commit
4abe0064e6
24
src/SPC/command/dev/AllExtCommand.php
Normal file
24
src/SPC/command/dev/AllExtCommand.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\command\dev;
|
||||
|
||||
use SPC\command\BaseCommand;
|
||||
use SPC\store\Config;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
||||
#[AsCommand('dev:ext-all', 'Dev command')]
|
||||
class AllExtCommand extends BaseCommand
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
}
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$this->output->writeln(implode(',', array_keys(Config::getExts())));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
43
src/SPC/command/dev/ExtInfoCommand.php
Normal file
43
src/SPC/command/dev/ExtInfoCommand.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\command\dev;
|
||||
|
||||
use SPC\command\BaseCommand;
|
||||
use SPC\store\Config;
|
||||
use SPC\util\DependencyUtil;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
#[AsCommand('dev:ext-info', 'Dev command')]
|
||||
class ExtInfoCommand extends BaseCommand
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
$this->addArgument('extensions', InputArgument::REQUIRED, 'The extension name you need to get info');
|
||||
}
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions'))));
|
||||
|
||||
// 根据提供的扩展列表获取依赖库列表并编译
|
||||
foreach ($extensions as $extension) {
|
||||
$this->output->writeln('<comment>[ ' . $extension . ' ]</comment>');
|
||||
[, $libraries, $not_included] = DependencyUtil::getExtLibsByDeps([$extension]);
|
||||
$lib_suggests = Config::getExt($extension, 'lib-suggests', []);
|
||||
$ext_suggests = Config::getExt($extension, 'ext-suggests', []);
|
||||
$this->output->writeln("<info>lib-depends:\t" . implode(', ', $libraries) . '</info>');
|
||||
$this->output->writeln("<info>lib-suggests:\t" . implode(', ', $lib_suggests) . '</info>');
|
||||
$this->output->writeln("<info>ext-depends:\t" . implode(',', $not_included) . '</info>');
|
||||
$this->output->writeln("<info>ext-suggests:\t" . implode(', ', $ext_suggests) . '</info>');
|
||||
if (Config::getExt($extension, 'unix-only', false)) {
|
||||
$this->output->writeln("<info>Unix only:\ttrue</info>");
|
||||
}
|
||||
$this->output->writeln('');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user