use built-in default value

This commit is contained in:
sunxyw
2022-12-31 23:01:00 +08:00
parent 85240c753b
commit 413d783d53

View File

@@ -19,14 +19,14 @@ class BuildCommand extends Command
protected function configure() protected function configure()
{ {
$this->setHelp('此功能将会把整个项目打包为 Phar'); $this->setHelp('此功能将会把整个项目打包为 Phar');
$this->addOption('target', 'D', InputOption::VALUE_REQUIRED, '指定输出文件位置'); $this->addOption('target', 'D', InputOption::VALUE_REQUIRED, '指定输出文件位置', 'zm.phar');
} }
protected function handle(): int protected function handle(): int
{ {
$this->ensurePharWritable(); $this->ensurePharWritable();
$target = $this->input->getOption('target') ?? 'zm.phar'; $target = $this->input->getOption('target');
if (FileSystem::isRelativePath($target)) { if (FileSystem::isRelativePath($target)) {
$target = SOURCE_ROOT_DIR . '/' . $target; $target = SOURCE_ROOT_DIR . '/' . $target;
} }