private void RemoveSource()
{
if (String.IsNullOrEmpty(Name))
{
throw new CommandLineException(NuGetResources.SourcesCommandNameRequired);
}
// Check to see if we already have a registered source with the same name or source
var sourceList = _sourceProvider.LoadPackageSources().ToList();
var matchingSources = sourceList.Where(ps => String.Equals(Name, ps.Name, StringComparison.OrdinalIgnoreCase)).ToList();
if (!matchingSources.Any())
{
throw new CommandLineException(NuGetResources.SourcesCommandNoMatchingSourcesFound, Name);
}
sourceList.RemoveAll(matchingSources.Contains);
_sourceProvider.SavePackageSources(sourceList);
Console.WriteLine(NuGetResources.SourcesCommandSourceRemovedSuccessfully, Name);
}