如何在不使用名称运行命令的情况下获得命令的描述



如果我使用这样的命令:

class ImportFilesCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setDescription('A text describing my command.')
->setName('app:import:files')
);
}

是否可以获得描述"描述我的命令的文本。">使用命令app:import:files的名称,而不执行该命令?

我会在控制器中使用这个。

此代码在控制器上工作:

$application = new Application($this->get('kernel'));
$description = $application->find('app:import:files')->getDescription();

相关内容

最新更新