protected override void ProcessRecord() { Name = Utils.ProcessNameWildcards(Name, out string[] _, out bool nameContainsWildcard); if (nameContainsWildcard) { var message = String.Format("Name: '{0}, cannot contain wildcards", String.Join(", ", Name)); var ex = new ArgumentException(message); var NameContainsWildCardError = new ErrorRecord(ex, "nameContainsWildCardError", ErrorCategory.ReadError, null); WriteError(NameContainsWildCardError); return; } string nameArrayAsString = string.Join(", ", Name); WriteVerbose(String.Format("removing repository {0}. Calling Remove() API now", nameArrayAsString)); if (!ShouldProcess(nameArrayAsString, "Unregister repositories from repository store")) { return; } List <PSRepositoryInfo> removedRepositories = RepositorySettings.Remove(Name, out string[] errorList); // handle non-terminating errors foreach (string error in errorList) { WriteError(new ErrorRecord( new PSInvalidOperationException(error), "ErrorUnregisteringSpecifiedRepo", ErrorCategory.InvalidOperation, this)); } if (PassThru) { foreach (PSRepositoryInfo repository in removedRepositories) { WriteObject(repository); } } }
protected override void ProcessRecord() { string nameArrayAsString = string.Join(", ", Name); WriteDebug(String.Format("removing repository {0}. Calling Remove() API now", nameArrayAsString)); if (!ShouldProcess(nameArrayAsString, "Unregister repositories from repository store")) { return; } RepositorySettings.Remove(Name, out string[] errorList); // handle non-terminating errors foreach (string error in errorList) { WriteError(new ErrorRecord( new PSInvalidOperationException(error), "ErrorUnregisteringSpecifiedRepo", ErrorCategory.InvalidOperation, this)); } }