diff --git a/src/Console/Command/DebugCommand.php b/src/Console/Command/DebugCommand.php index 9d2cdc6..d6caad0 100644 --- a/src/Console/Command/DebugCommand.php +++ b/src/Console/Command/DebugCommand.php @@ -63,6 +63,10 @@ final class DebugCommand extends Command { Log::info("执行 $this->desc"); // + if (is_null($this->values()['plugin']) || $this->values()['plugins']) { + failExit('发生错误,未加载插件'); + } + // $p = $this->values()['plugin']; if (is_null($p)) { $temp = $this->values()['plugins']; @@ -76,7 +80,7 @@ final class DebugCommand extends Command // $plugins = Plugin::getPlugins(); foreach ($plugins as $plugin) { - if(!in_array($plugin['hook'],$pp)){ + if (!in_array($plugin['hook'], $pp)) { continue; } Task::addTask($plugin['hook'], null); @@ -85,5 +89,4 @@ final class DebugCommand extends Command Task::execTasks(); } - -} \ No newline at end of file +} diff --git a/src/Console/Console.php b/src/Console/Console.php index 16841fe..2e9f58b 100644 --- a/src/Console/Console.php +++ b/src/Console/Console.php @@ -86,6 +86,18 @@ LOGO; 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 */ @@ -98,7 +110,7 @@ LOGO; ->add(new RestoreCommand(), 'm:r') // 模式3 ->add(new DebugCommand(), 'm:d') // 模式4 ->logo($this->logo) - ->handle($this->argv); + ->handle($this->transArgv($this->argv)); } } diff --git a/src/Util/Common/Common.php b/src/Util/Common/Common.php index e944f39..1376bd2 100644 --- a/src/Util/Common/Common.php +++ b/src/Util/Common/Common.php @@ -112,7 +112,7 @@ class Common * @param int $length * @return string */ - public static function randString(int $length):string + public static function randString(int $length): string { // $output=''; // for ($a = 0; $a<$length; $a++) { @@ -126,4 +126,4 @@ class Common return $key; } -} \ No newline at end of file +}