Skip to content

Commit

Permalink
fix help msg
Browse files Browse the repository at this point in the history
  • Loading branch information
lotfio committed Jul 24, 2020
1 parent 5f268a3 commit 873241b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ $conso->command("test", function($input, $output){
]
]);
```
![image](https://user-images.githubusercontent.com/18489496/88348026-9d63e680-cd4c-11ea-8efc-60ac5376064e.png)
![image](https://user-images.githubusercontent.com/18489496/88392798-e94e7400-cdbc-11ea-8de6-5fab02cdfb01.png)

### :star: class commands
- class commands are very helpful for big commands
Expand Down
10 changes: 7 additions & 3 deletions src/Conso/hlprs.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function commandHelp(array $command, $output)
$help = $command['help'];

$output->writeLn("\n help for [".$name."] command:\n\n", 'yellow');
$output->writeLn(" php conso $name:[sub command] [options] [flags]\n");
$output->writeLn(" php conso $name:[sub command] [options] [flags]\n");

if (is_array($help) && count($help) > 0) {

Expand All @@ -100,8 +100,12 @@ function commandHelp(array $command, $output)
$output->writeLn("\n ".$key.":\n\n", 'yellow');

// get longest
$max = array_map(function($elem){ return strlen($elem);}, array_keys($value));
$max = max($max);
$max = 0;
if(count($value) > 0)
{
$max = array_map(function($elem){ return strlen($elem);}, array_keys($value));
$max = max($max);
}

foreach ($value as $a => $b) {

Expand Down

0 comments on commit 873241b

Please sign in to comment.