Permalink
Browse files

provided unmerged definition for correct help generation

  • Loading branch information...
1 parent 41e1cc4 commit bc6b1515fcbcab4aa9c561b0ee4b507588063d39 Andreas Hucks committed Mar 12, 2012
Showing with 18 additions and 4 deletions.
  1. +18 −4 Command/ListCommand.php
View
@@ -17,6 +17,7 @@
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 @@ protected function configure()
);
}
+ /**
+ * {@inheritdoc}
+ */
+ protected function getNativeDefinition()
+ {
+ return $this->createDefinition();
+ }
+
/**
* {@inheritdoc}
*/
@@ -64,4 +70,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$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'),
+ ));
+ }
}

0 comments on commit bc6b151

Please sign in to comment.