1
0
Fork 0

Extend proper method to register commands at startup

pull/736/head
Jordi Boggiano 2012-05-28 00:10:02 +02:00
parent 8ffe3c2e26
commit 9841b6f36e
1 changed files with 15 additions and 13 deletions

View File

@ -64,7 +64,6 @@ class Application extends BaseApplication
*/ */
public function doRun(InputInterface $input, OutputInterface $output) public function doRun(InputInterface $input, OutputInterface $output)
{ {
$this->registerCommands();
$this->io = new ConsoleIO($input, $output, $this->getHelperSet()); $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
if (version_compare(PHP_VERSION, '5.3.2', '<')) { if (version_compare(PHP_VERSION, '5.3.2', '<')) {
@ -106,22 +105,25 @@ class Application extends BaseApplication
/** /**
* Initializes all the composer commands * Initializes all the composer commands
*/ */
protected function registerCommands() protected function getDefaultCommands()
{ {
$this->add(new Command\AboutCommand()); $commands = parent::getDefaultCommands();
$this->add(new Command\DependsCommand()); $commands[] = new Command\AboutCommand();
$this->add(new Command\InitCommand()); $commands[] = new Command\DependsCommand();
$this->add(new Command\InstallCommand()); $commands[] = new Command\InitCommand();
$this->add(new Command\CreateProjectCommand()); $commands[] = new Command\InstallCommand();
$this->add(new Command\UpdateCommand()); $commands[] = new Command\CreateProjectCommand();
$this->add(new Command\SearchCommand()); $commands[] = new Command\UpdateCommand();
$this->add(new Command\ValidateCommand()); $commands[] = new Command\SearchCommand();
$this->add(new Command\ShowCommand()); $commands[] = new Command\ValidateCommand();
$this->add(new Command\RequireCommand()); $commands[] = new Command\ShowCommand();
$commands[] = new Command\RequireCommand();
if ('phar:' === substr(__FILE__, 0, 5)) { if ('phar:' === substr(__FILE__, 0, 5)) {
$this->add(new Command\SelfUpdateCommand()); $commands[] = new Command\SelfUpdateCommand();
} }
return $commands;
} }
/** /**