mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
add pack command
This commit is contained in:
parent
9867004c7d
commit
00126cb1c8
41
src/ZM/Command/Plugin/PluginPackCommand.php
Normal file
41
src/ZM/Command/Plugin/PluginPackCommand.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ZM\Command\Plugin;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use ZM\Bootstrap;
|
||||
use ZM\Command\Command;
|
||||
use ZM\Exception\PluginException;
|
||||
use ZM\Plugin\PluginManager;
|
||||
|
||||
#[AsCommand(name: 'plugin:pack', description: '打包插件到 Phar 格式')]
|
||||
class PluginPackCommand extends Command
|
||||
{
|
||||
protected array $bootstrappers = [
|
||||
BootStrap\RegisterLogger::class,
|
||||
Bootstrap\SetInternalTimezone::class,
|
||||
Bootstrap\LoadConfiguration::class,
|
||||
];
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->addArgument('name', InputArgument::REQUIRED, '要打包的插件名称');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function handle(): int
|
||||
{
|
||||
try {
|
||||
PluginManager::packPlugin($this->input->getArgument('name'));
|
||||
} catch (PluginException $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->output->writeln('打包插件到 Phar 格式');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user