优化输出

This commit is contained in:
2023-09-20 11:39:35 +08:00
parent d4dca5d778
commit 0b23e0a940

View File

@@ -11,6 +11,7 @@ use League\Flysystem\Local\LocalFilesystemAdapter;
use League\Flysystem\StorageAttributes; use League\Flysystem\StorageAttributes;
use think\console\Command; use think\console\Command;
use think\console\Input; use think\console\Input;
use think\console\input\Option;
use think\console\Output; use think\console\Output;
use think\facade\App; use think\facade\App;
use think\facade\Env; use think\facade\Env;
@@ -23,6 +24,7 @@ class Update extends Command
{ {
// 指令配置 // 指令配置
$this->setName('admin:update') $this->setName('admin:update')
->addOption('show-diff', null, Option::VALUE_NONE, 'show changed files diff')
->setDescription('the admin:update command'); ->setDescription('the admin:update command');
} }
@@ -146,10 +148,12 @@ class Update extends Command
foreach ($changed_files as $file_path => $compare_result) { foreach ($changed_files as $file_path => $compare_result) {
$output->warning($file_path); $output->warning($file_path);
if ($input->hasOption('show-diff')) {
if (is_string($compare_result)) { if (is_string($compare_result)) {
$output->writeln($compare_result); $output->writeln($compare_result);
} }
} }
}
$file_count = count($changed_files); $file_count = count($changed_files);