addOption('all', 'a', InputOption::VALUE_NONE, 'Show all modules including disabled ones') ->setHelp('This command lists all installed modules with their status and version information.') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $showAll = $input->getOption('all'); $io->title('Installed Modules'); try { $modules = $this->moduleManager->list( installedOnly: true, enabledOnly: !$showAll ); if (count($modules) === 0) { $io->warning('No modules found.'); return Command::SUCCESS; } $rows = []; foreach ($modules as $module) { $status = $module->enabled() ? 'Enabled' : 'Disabled'; $upgrade = $module->needsUpgrade() ? 'Yes' : ''; $rows[] = [ $module->handle(), $module->version(), $status, $upgrade, $module->namespace() ?? 'N/A', ]; } $io->table( ['Handle', 'Version', 'Status', 'Needs Upgrade', 'Namespace'], $rows ); $io->success(sprintf('Found %d module(s).', count($modules))); return Command::SUCCESS; } catch (\Throwable $e) { $io->error('Failed to list modules: ' . $e->getMessage()); return Command::FAILURE; } } }