Skip to content

Commit

Permalink
fix: HelpCommand doest display command list (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
SonyPradana authored Nov 3, 2023
1 parent d2ff04a commit fa2c3b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/System/Integrate/Console/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ public function commandList(): int
$maks1 = 0;
$maks2 = 0;
foreach ($this->commandMaps() as $command) {
$lenght = Str::length(implode(', ', $command->patterns()));
$option = array_merge($command->cmd(), $command->patterns());
$lenght = Str::length(implode(', ', $option));

if ($lenght > $maks1) {
$maks1 = $lenght;
}
Expand All @@ -179,9 +181,10 @@ public function commandList(): int
}

foreach ($this->commandMaps() as $command) {
style(implode(', ', $command->patterns()))->textLightYellow()->out(false);
$option = array_merge($command->cmd(), $command->patterns());
style(implode(', ', $option))->textLightYellow()->out(false);

$lenght1 = Str::length(implode(', ', $command->patterns()));
$lenght1 = Str::length(implode(', ', $option));
$lenght2 = Str::length($command->class());
style('')
->repeat(' ', $maks1 - $lenght1 + 4)
Expand Down
3 changes: 3 additions & 0 deletions src/System/Integrate/ValueObjects/CommandMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public function __construct(array $command)
*/
public function cmd()
{
if (false === array_key_exists('cmd', $this->command)) {
return [];
}
$cmd = $this->command['cmd'];

return is_array($cmd) ? $cmd : [$cmd];
Expand Down

0 comments on commit fa2c3b5

Please sign in to comment.