Skip to content

Commit

Permalink
Fix list command not showing plugin commands, fixes #10075
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 29, 2021
1 parent 2c292e7 commit 0158436
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Composer/Console/Application.php
Expand Up @@ -187,9 +187,16 @@ public function doRun(InputInterface $input, OutputInterface $output)
}

// 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 {
foreach ($this->getPluginCommands() as $command) {
if ($this->has($command->getName())) {
Expand Down

0 comments on commit 0158436

Please sign in to comment.