diff --git a/src/Decorate/CommandHelpTrait.php b/src/Decorate/CommandHelpTrait.php index bb5ebad..db90e1b 100644 --- a/src/Decorate/CommandHelpTrait.php +++ b/src/Decorate/CommandHelpTrait.php @@ -136,12 +136,11 @@ public function showHelpByFlagsParser(FlagsParser $fs, array $aliases = [], stri $binName = $this->input->getBinName(); $cmdPath = $binName . ' ' . $this->getPath(); - // if ($action) { - // $group = $this->getGroupName(); - // $cmdPath = "$binName $group $action"; - // } - if ($this->hasSubs()) { + if ($action) { + // $group = $this->getGroupName(); + $cmdPath .= " $action"; + } elseif ($this->hasSubs()) { $cmdPath .= ' SUBCOMMAND'; } @@ -153,7 +152,8 @@ public function showHelpByFlagsParser(FlagsParser $fs, array $aliases = [], stri $help['Options:'] = FlagUtil::alignOptions($fs->getOptsHelpLines()); $help['Argument:'] = $fs->getArgsHelpLines(); - if ($subCmds = $this->getSubsForHelp()) { + // fix: action should not have sub-commands + if (!$action && ($subCmds = $this->getSubsForHelp())) { // sort commands ksort($subCmds); $help['Commands:'] = $subCmds; diff --git a/src/Decorate/SubCommandsWareTrait.php b/src/Decorate/SubCommandsWareTrait.php index 2bf1493..8b8b39a 100644 --- a/src/Decorate/SubCommandsWareTrait.php +++ b/src/Decorate/SubCommandsWareTrait.php @@ -265,9 +265,9 @@ public function getRoot(): static } /** - * @return static|null + * @return AbstractHandler|null */ - public function getParent(): ?static + public function getParent(): ?AbstractHandler { return $this->parent; }