void (@NotNull List<String> args) { try { var pluginIds = new LinkedHashSet<PluginId>(); var customRepositories = new LinkedHashSet<String>(); var projectPaths = new ArrayList<Path>(); for (int i = 1; i < args.size(); i++) { var arg = args.get(i); if ("-h".equals(arg) || "--help".equals(arg)) { System.out.println( """ Usage: installPlugins pluginId* repository* (--for-project=<project-path>)* Installs plugins with `pluginId` from the Marketplace or provided `repository`-es. If `--for-project` is specified, also installs the required plugins for a project located at <project-path>."""); } else if (arg.startsWith("--for-project=")) { projectPaths.add(Path.of(arg.replace("--for-project=", ""))); } else if (arg.contains(URLUtil.SCHEME_SEPARATOR)) { customRepositories.add(arg); } else { pluginIds.add(PluginId.getId(arg)); } } collectProjectRequiredPlugins(pluginIds, projectPaths); if (!customRepositories.isEmpty()) { var hosts = System.getProperty("idea.plugin.hosts"); var newHosts = String.join(";", customRepositories); if (hosts != null && !hosts.isBlank()) { newHosts = hosts + ";" + newHosts; } System.setProperty("idea.plugin.hosts", newHosts); LOG.info("plugin hosts: " + newHosts); } LOG.info("installing: " + pluginIds); var installed = installPlugins(pluginIds); System.exit(installed.size() == pluginIds.size() ? 0 : 1); } catch (Throwable t) { LOG.error(t); System.exit(1); } }