addArgument('name', InputArgument::REQUIRED, 'Plugin name'); } /** * 执行命令 */ public function __invoke(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $io->title('Plugin Uninstaller'); // 获取参数 $name = $input->getArgument('name'); $io->info("Uninstalling plugin: {$name}"); // 确认卸载 if (!$this->confirm($io, "Are you sure you want to uninstall plugin {$name}? This action cannot be undone.")) { $io->note("Uninstallation cancelled"); return Command::SUCCESS; } try { // 创建卸载服务实例(统一入口) $uninstallService = new PluginUninstallService(); // 执行卸载流程(使用基类的流式处理) return $this->executeStream($uninstallService->uninstall($name), $io, $name); } catch (\Exception $e) { return $this->outputError($io, sprintf("Uninstallation failed: %s", $e->getMessage()), $e); } } }