If I use a command like this one:
class ImportFilesCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setDescription('A text describing my command.')
->setName('app:import:files')
);
}
Is it possible to get the description 'A text describing my command.' using the name of the command app:import:files
, without executing the command?
I would use this inside a controller.
CodePudding user response:
This code works from a controller:
$application = new Application($this->get('kernel'));
$description = $application->find('app:import:files')->getDescription();
CodePudding user response:
You can simply call bin/console list
which will show all available commands and their descriptions, from there you can just match the name of the command.
Or you can use the --help flag
bin/console app:import:files --help