Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 00b1d79

Browse filesBrowse files
committed
Fix passing options with defaultCommand
1 parent 6008489 commit 00b1d79
Copy full SHA for 00b1d79

File tree

3 files changed

+14
-2
lines changed
Filter options

3 files changed

+14
-2
lines changed

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ public function doRun(InputInterface $input, OutputInterface $output)
179179

180180
if (!$name) {
181181
$name = $this->defaultCommand;
182-
$input = new ArrayInput(array('command' => $this->defaultCommand));
182+
$inputArgument = $this->definition->getArgument('command');
183+
$inputArgument->setMode(InputArgument::OPTIONAL);
184+
$inputArgument->setDefault($name);
183185
}
184186

185187
// the command name MUST be the first element of the input

‎src/Symfony/Component/Console/Input/InputArgument.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/InputArgument.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ public function setDefault($default = null)
106106
$this->default = $default;
107107
}
108108

109+
/**
110+
* Sets argument's mode.
111+
*
112+
* @param int $mode
113+
*/
114+
public function setMode($mode)
115+
{
116+
$this->mode = $mode;
117+
}
118+
109119
/**
110120
* Returns the default value.
111121
*

‎src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage:
22
help [options] [--] [<command_name>]
33

44
Arguments:
5-
command The command to execute
5+
command The command to execute [default: "list"]
66
command_name The command name [default: "help"]
77

88
Options:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.