simplify command help example

This commit is contained in:
sunxyw
2022-05-03 16:13:13 +08:00
parent 7df05df48f
commit 35e23a7cbc

View File

@@ -236,10 +236,9 @@ class Hello
{ {
$util = resolve(CommandInfoUtil::class); $util = resolve(CommandInfoUtil::class);
$commands = $util->get(); $commands = $util->get();
$helps = []; $helps = array_map(static function ($command) use ($util) {
foreach ($commands as $command) { return $util->getHelp($command['id']);
$helps[] = $util->getHelp($command['id']); }, $commands);
}
array_unshift($helps, '帮助:'); array_unshift($helps, '帮助:');
return implode("\n", $helps); return implode("\n", $helps);
} }