*/ protected $arguments = [ 'plugins' => 'One or more plugins as vendor/plugin', ]; /** * @param list $params */ #[Override] public function run(array $params): int { parent::run($params); /** @var Plugins $plugins */ $plugins = service('plugins'); /** @var PluginsManager $cpm */ $cpm = service('cpm'); /** @var list $errors */ $errors = []; foreach ($params as $pluginKey) { $plugin = $plugins->getPluginByKey($pluginKey); if ($plugin === null) { $errors[] = sprintf('Plugin %s was not found.', $pluginKey); continue; } if (! $plugins->uninstall($plugin)) { $errors[] = sprintf('Something happened when removing %s', $pluginKey); break; } // delete plugin folder $cpm->remove($pluginKey); } foreach ($errors as $error) { CLI::write(' error ', 'white', 'red'); CLI::error($error); CLI::newLine(); } return $errors === [] ? 0 : 1; } }