private int ForgetRepository(ForgetOptions options) { if (options.name == null) { User.RaiseError("forget <name> - argument missing, perhaps you forgot it?"); return(Exit.BADOPT); } RegistryManager manager = Manager.CurrentInstance.RegistryManager; var registry = manager.registry; log.DebugFormat("About to forget repository '{0}'", options.name); var repos = registry.Repositories; string name = options.name; if (!repos.ContainsKey(options.name)) { name = repos.Keys.FirstOrDefault(repo => repo.Equals(options.name, StringComparison.OrdinalIgnoreCase)); if (name == null) { User.RaiseMessage("Couldn't find repository with name \"{0}\", aborting..", options.name); return(Exit.BADOPT); } User.RaiseMessage("Removing insensitive match \"{0}\"", name); } registry.Repositories.Remove(name); User.RaiseMessage("Successfully removed \"{0}\"", options.name); manager.Save(); return(Exit.OK); }
private int ForgetRepository(ForgetOptions options) { RegistryManager manager = Manager.CurrentInstance.RegistryManager; if (options.name == null) { User.RaiseError("forget <name> - argument missing, perhaps you forgot it?"); return(Exit.BADOPT); } log.DebugFormat("About to forget repository '{0}'", options.name); SortedDictionary <string, Repository> repositories = manager.registry.Repositories; // TODO make forgetting case insensitive, too if (!(repositories.ContainsKey(options.name))) { User.RaiseMessage("Couldn't find repository with name \"{0}\", aborting..", options.name); return(Exit.BADOPT); } repositories.Remove(options.name); User.RaiseMessage("Successfully removed \"{0}\"", options.name); manager.Save(); return(Exit.OK); }
private int ForgetInstall(ForgetOptions options) { if (options.name == null) { User.RaiseMessage("forget <name> - argument missing, perhaps you forgot it?"); return(Exit.BADOPT); } if (!Manager.HasInstance(options.name)) { User.RaiseMessage("Couldn't find install with name \"{0}\", aborting..", options.name); return(Exit.BADOPT); } Manager.RemoveInstance(options.name); User.RaiseMessage("Successfully removed \"{0}\"", options.name); return(Exit.OK); }
private static int ForgetInstall(ForgetOptions options) { if (options.name == null) { User.WriteLine("forget <name> - argument missing, perhaps you forgot it?"); return(Exit.BADOPT); } if (!KSPManager.Instances.ContainsKey(options.name)) { User.WriteLine("Couldn't find install with name \"{0}\", aborting..", options.name); return(Exit.BADOPT); } KSPManager.RemoveInstance(options.name); User.WriteLine("Successfully removed \"{0}\"", options.name); return(Exit.OK); }
private int ForgetInstall(ForgetOptions options) { if (options.name == null) { User.RaiseMessage("forget <name> - argument missing, perhaps you forgot it?"); return Exit.BADOPT; } if (!Manager.HasInstance(options.name)) { User.RaiseMessage("Couldn't find install with name \"{0}\", aborting..", options.name); return Exit.BADOPT; } Manager.RemoveInstance(options.name); User.RaiseMessage("Successfully removed \"{0}\"", options.name); return Exit.OK; }
private int ForgetRepository(ForgetOptions options) { if (options.name == null) { User.RaiseError("forget <name> - argument missing, perhaps you forgot it?"); return Exit.BADOPT; } RegistryManager manager = Manager.CurrentInstance.RegistryManager; var registry = manager.registry; log.DebugFormat("About to forget repository '{0}'", options.name); var repos = registry.Repositories; string name = options.name; if (!repos.ContainsKey(options.name)) { name = repos.Keys.FirstOrDefault(repo => repo.Equals(options.name, StringComparison.OrdinalIgnoreCase)); if (name == null) { User.RaiseMessage("Couldn't find repository with name \"{0}\", aborting..", options.name); return Exit.BADOPT; } User.RaiseMessage("Removing insensitive match \"{0}\"", name); } registry.Repositories.Remove(name); User.RaiseMessage("Successfully removed \"{0}\"", options.name); manager.Save(); return Exit.OK; }
private int ForgetRepository(ForgetOptions options) { RegistryManager manager = Manager.CurrentInstance.RegistryManager; if (options.name == null) { User.RaiseError("forget <name> - argument missing, perhaps you forgot it?"); return Exit.BADOPT; } log.DebugFormat("About to forget repository '{0}'", options.name); SortedDictionary<string, Repository> repositories = manager.registry.Repositories; // TODO make forgetting case insensitive, too if (!(repositories.ContainsKey(options.name))) { User.RaiseMessage("Couldn't find repository with name \"{0}\", aborting..", options.name); return Exit.BADOPT; } repositories.Remove(options.name); User.RaiseMessage("Successfully removed \"{0}\"", options.name); manager.Save(); return Exit.OK; }