[fix] Command argv parse error

This commit is contained in:
Lkeme 2022-09-10 17:12:51 +08:00
parent 5b814434a8
commit 924c71ad9e
3 changed files with 21 additions and 6 deletions

View File

@ -63,6 +63,10 @@ final class DebugCommand extends Command
{ {
Log::info("执行 $this->desc"); Log::info("执行 $this->desc");
// //
if (is_null($this->values()['plugin']) || $this->values()['plugins']) {
failExit('发生错误,未加载插件');
}
//
$p = $this->values()['plugin']; $p = $this->values()['plugin'];
if (is_null($p)) { if (is_null($p)) {
$temp = $this->values()['plugins']; $temp = $this->values()['plugins'];
@ -85,5 +89,4 @@ final class DebugCommand extends Command
Task::execTasks(); Task::execTasks();
} }
} }

View File

@ -86,6 +86,18 @@ LOGO;
return $filename; return $filename;
} }
/**
* @param array $argv
* @return array
*/
protected function transArgv(array $argv): array
{
if (!str_contains($argv[1], ':')) {
unset($argv[1]);
}
return array_values($argv);
}
/** /**
* @return void * @return void
*/ */
@ -98,7 +110,7 @@ LOGO;
->add(new RestoreCommand(), 'm:r') // 模式3 ->add(new RestoreCommand(), 'm:r') // 模式3
->add(new DebugCommand(), 'm:d') // 模式4 ->add(new DebugCommand(), 'm:d') // 模式4
->logo($this->logo) ->logo($this->logo)
->handle($this->argv); ->handle($this->transArgv($this->argv));
} }
} }