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)