fix help generator not working with alias (#69)

This commit is contained in:
sunxyw
2022-03-23 19:44:16 +08:00
committed by GitHub
parent c077e9418c
commit d73e771ef3

View File

@@ -298,9 +298,15 @@ class MessageUtil
foreach ($possible_keys as $key => $help_format) { foreach ($possible_keys as $key => $help_format) {
// 如果定义了该参数,则添加到帮助信息中 // 如果定义了该参数,则添加到帮助信息中
if (isset($annotation->{$key}) && !empty($annotation->{$key})) { if (isset($annotation->{$key}) && !empty($annotation->{$key})) {
if (is_iterable($annotation->{$key})) {
foreach ($annotation->{$key} as $item) {
$command_seg[] = sprintf($help_format, $item);
}
} else {
$command_seg[] = sprintf($help_format, $annotation->{$key}); $command_seg[] = sprintf($help_format, $annotation->{$key});
} }
} }
}
// 第一个触发参数为主命令名 // 第一个触发参数为主命令名
$command = array_shift($command_seg); $command = array_shift($command_seg);
if (count($command_seg) > 0) { if (count($command_seg) > 0) {