diff --git a/src/Application.php b/src/Application.php index bb06fcc..43a2e13 100644 --- a/src/Application.php +++ b/src/Application.php @@ -113,10 +113,7 @@ public function doRun(InputInterface $input, OutputInterface $output) $output->write(sprintf("\033\143")); } - $this->registerGenerators(); - $this->registerCommands(); - $this->registerEvents(); - $this->registerExtendCommands(); + $this->loadCommands(); /** * @var ConfigurationManager $configurationManager @@ -124,18 +121,6 @@ public function doRun(InputInterface $input, OutputInterface $output) $configurationManager = $this->container ->get('console.configuration_manager'); - $config = $configurationManager->getConfiguration() - ->get('application.extras.config')?:'true'; - if ($config === 'true') { - $this->registerCommandsFromAutoWireConfiguration(); - } - - $chains = $configurationManager->getConfiguration() - ->get('application.extras.chains')?:'true'; - if ($chains === 'true') { - $this->registerChainCommands(); - } - if (!$this->has($this->commandName)) { $isValidCommand = false; $config = $configurationManager->getConfiguration(); @@ -199,6 +184,7 @@ public function doRun(InputInterface $input, OutputInterface $output) $input, $output ); + if ($this->showMessages($input)) { $messages = $messageManager->getMessages(); @@ -216,6 +202,32 @@ public function doRun(InputInterface $input, OutputInterface $output) return $code; } + public function loadCommands() + { + $this->registerGenerators(); + $this->registerCommands(); + $this->registerEvents(); + $this->registerExtendCommands(); + + /** + * @var ConfigurationManager $configurationManager + */ + $configurationManager = $this->container + ->get('console.configuration_manager'); + + $config = $configurationManager->getConfiguration() + ->get('application.extras.config')?:'true'; + if ($config === 'true') { + $this->registerCommandsFromAutoWireConfiguration(); + } + + $chains = $configurationManager->getConfiguration() + ->get('application.extras.chains')?:'true'; + if ($chains === 'true') { + $this->registerChainCommands(); + } + } + /** * @param InputInterface $input *