8000 [Command] Added better support for custom default command by lyrixx · Pull Request #16901 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Command] Added better support for custom default command #16901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -1017,6 +1021,8 @@ private function findAlternatives($name, $collection)
public function setDefaultCommand($commandName)
{
$this->defaultCommand = $commandName;

return $this;
}

private function stringWidth($string)
Expand Down
0