-
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathHelpCommand.php
More file actions
37 lines (32 loc) · 849 Bytes
/
HelpCommand.php
File metadata and controls
37 lines (32 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
/**
* This file is part of Simps.
*
* @link https://simps.io
* @document https://doc.simps.io
* @license https://github.com/simple-swoole/simps/blob/master/LICENSE
*/
namespace Simps\Console\Other;
use Simps\Console\Command;
class HelpCommand extends Command
{
protected $command = 'help';
protected $help = 'Show all commands';
public function handle()
{
$commands = [];
$list = $this->app->getConsole();
foreach ($list as $cls) {
$obj = new $cls($this->app);
if ($obj->getShow()) {
$k = $obj->getCommand();
$v = $obj->getHelp();
$commands[$k] = $v;
}
}
foreach ($commands as $command => $help) {
echo "{$command}\t\t`{$help}`\n";
}
}
}