2019-12-16 17:25:40 +08:00
|
|
|
<?php
|
|
|
|
declare (strict_types = 1);
|
|
|
|
|
2020-04-29 15:06:13 +08:00
|
|
|
namespace catcher\command\Tools;
|
2019-12-16 17:25:40 +08:00
|
|
|
|
2020-04-30 14:51:32 +08:00
|
|
|
use catcher\library\Compress;
|
2019-12-16 17:25:40 +08:00
|
|
|
use think\console\Command;
|
|
|
|
use think\console\Input;
|
|
|
|
use think\console\input\Argument;
|
|
|
|
use think\console\Output;
|
|
|
|
|
2019-12-17 09:03:32 +08:00
|
|
|
class CompressPackageCommand extends Command
|
2019-12-16 17:25:40 +08:00
|
|
|
{
|
|
|
|
protected function configure()
|
|
|
|
{
|
|
|
|
// 指令配置
|
|
|
|
$this->setName('package:zip')
|
|
|
|
->addArgument('package', Argument::REQUIRED, 'package name')
|
|
|
|
->setDescription('compress package to zip');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
|
|
{
|
|
|
|
$package = $this->input->getArgument('package');
|
|
|
|
|
2019-12-17 09:03:32 +08:00
|
|
|
try {
|
2020-04-30 14:51:32 +08:00
|
|
|
(new Compress())->moduleToZip($package);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$output->error($e->getMessage());
|
2020-04-29 17:35:29 +08:00
|
|
|
}
|
2019-12-17 09:03:32 +08:00
|
|
|
|
2020-04-30 14:51:32 +08:00
|
|
|
$output->info($package . ' zip successfully~');
|
2019-12-16 17:25:40 +08:00
|
|
|
}
|
|
|
|
}
|