1
0
Fork 0

Fix list command not showing plugin commands, fixes #10075

pull/10086/head
Jordi Boggiano 2021-08-29 13:03:45 +02:00
parent 2c292e705d
commit 0158436fb4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 9 additions and 2 deletions

View File

@ -187,9 +187,16 @@ class Application extends BaseApplication
} }
// avoid loading plugins/initializing the Composer instance earlier than necessary if no plugin command is needed // avoid loading plugins/initializing the Composer instance earlier than necessary if no plugin command is needed
$isComposerCommand = false !== $commandName; // if showing the version, we never need plugin commands
$mayNeedPluginCommand = false === $input->hasParameterOption(array('--version', '-V'))
&& (
// not a composer command, so try loading plugin ones
false === $commandName
// list command requires plugin commands to show them
|| in_array($commandName, array('', 'list'), true)
);
if (!$isComposerCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) { if ($mayNeedPluginCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
try { try {
foreach ($this->getPluginCommands() as $command) { foreach ($this->getPluginCommands() as $command) {
if ($this->has($command->getName())) { if ($this->has($command->getName())) {