From fd1656436d768e20594f8a77b2b75f87607e2f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 8 Dec 2015 11:50:00 +0100 Subject: [PATCH] [Command] Added better for custom default command --- src/Symfony/Component/Console/Application.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 166b7c458e948..0fb94ed1c1e52 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -168,7 +168,11 @@ public function doRun(InputInterface $input, OutputInterface $output) if (true === $input->hasParameterOption(array('--help', '-h'), true)) { if (!$name) { $name = 'help'; - $input = new ArrayInput(array('command' => 'help')); + if ('list' !== $this->defaultCommand) { + $input = new ArrayInput(array('command_name' => $this->defaultCommand)); + } else { + $input = new ArrayInput(array('command_name' => 'help')); + } } else { $this->wantHelps = true; } @@ -1017,6 +1021,8 @@ private function findAlternatives($name, $collection) public function setDefaultCommand($commandName) { $this->defaultCommand = $commandName; + + return $this; } private function stringWidth($string)