Skip to content

[Console] unmerge application args when needed #19181

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
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions src/Symfony/Component/Console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,19 @@ public function setCode($code)
public function mergeApplicationDefinition($mergeArgs = true)
{
if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
if (!$mergeArgs && $this->applicationDefinitionMergedWithArgs) {
$commandArgs = array_udiff(
$this->definition->getArguments(),
$this->application->getDefinition()->getArguments(),
function ($arg1, $arg2) {
return strcmp($arg1->getName(), $arg2->getName());
}
);

$this->definition->setArguments($commandArgs);
$this->applicationDefinitionMergedWithArgs = false;
}

return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Usage:
help [options] [--] [<command_name>]

Arguments:
command The command to execute
command_name The command name [default: "help"]

Options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
namespace:name
name

<comment>Arguments:</comment>
<info>command</info> The command to execute

<comment>Options:</comment>
<info>-h, --help</info> Display this help message
<info>-q, --quiet</info> Do not output any message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
</usages>
<description>description</description>
<help>help</help>
<arguments>
<argument name="command" is_required="1" is_array="0">
<description>The command to execute</description>
<defaults/>
</argument>
</arguments>
<arguments/>
<options>
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>Display this help message</description>
Expand Down