Skip to content

Commit b6e0048

Browse files
committed
【更新】
1 parent d5b363a commit b6e0048

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

src/AsyncManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ class AsyncManager extends Application
1010
protected $commands = [
1111
ListCommand::class, // 查看异步进程
1212
StopCommand::class, // 停止异步进程
13-
HelpCommand::class // 帮助命令
1413
];
1514

1615
public function __construct()
1716
{
17+
parent::__construct();
1818
foreach ($this->commands as $command) {
1919
try {
2020
$instance = new $command();
2121
} catch (Throwable $e) {
22-
throw CommandNotFoundException('命令:' . $command . '未找到');
22+
throw new CommandNotFoundException('命令: ' . $command . ' 未找到');
2323
}
2424
$this->add($instance);
2525
}

src/HelpCommand.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/ListCommand.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44
use Symfony\Component\Console\Command\Command;
55
use Symfony\Component\Console\Input\InputInterface;
66
use Symfony\Component\Console\Output\OutputInterface;
7+
use Symfony\Component\Console\Input\InputOption;
78

89
class ListCommand extends Command
910
{
1011
protected function configure()
1112
{
12-
$this->setName('list');
13+
$this->setName('list')
14+
->setAliases(['ls', 'l'])
15+
->addOption('filter', 'f', InputOption::VALUE_OPTIONAL, 'The option allows [<info>a</info>(ll), <info>r</info>(unning), <info>s</info>(topped), <info>c</info>(ompleted)]')
16+
->setDescription('list async jobs')
17+
->setHelp('The command allows you to get this async jobs');
1318
}
1419

1520
protected function execute(InputInterface $input, OutputInterface $output)
1621
{
17-
$output->writeln('显示');
22+
var_dump($input->getOptions());
1823
}
1924
}

0 commit comments

Comments
 (0)