Skip to content

Commit

Permalink
fix: fix some error for run sub cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 10, 2022
1 parent a09383d commit fdcf1c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Decorate/CommandHelpTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= ' <cyan>SUBCOMMAND</cyan>';
}

Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Decorate/SubCommandsWareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fdcf1c6

Please sign in to comment.