provided unmerged definition for correct help generation

This commit is contained in:
Andreas Hucks 2012-03-12 01:11:44 +01:00
parent 45bbb5be01
commit 705e46018e

View File

@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputDefinition;
/**
* ListCommand displays the list of all available commands for the application.
@ -31,10 +32,7 @@ class ListCommand extends Command
protected function configure()
{
$this
->setDefinition(array(
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
))
->setDefinition($this->createDefinition())
->setName('list')
->setDescription('Lists commands')
->setHelp(<<<EOF
@ -53,6 +51,14 @@ EOF
);
}
/**
* {@inheritdoc}
*/
protected function getNativeDefinition()
{
return $this->createDefinition();
}
/**
* {@inheritdoc}
*/
@ -64,4 +70,12 @@ EOF
$output->writeln($this->getApplication()->asText($input->getArgument('namespace')));
}
}
private function createDefinition()
{
return new InputDefinition(array(
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
));
}
}