Merge pull request #3229 from billwert/nuget-verbosity

Reduce nuget output
This commit is contained in:
Eric Erhardt 2016-05-25 17:16:22 -05:00
commit 203a9be510
4 changed files with 6 additions and 10 deletions

View file

@ -10,13 +10,13 @@ namespace Microsoft.DotNet.Tools.Restore
{
internal static class NuGet3
{
public static int Restore(IEnumerable<string> args, bool quiet)
public static int Restore(IEnumerable<string> args)
{
var prefixArgs = new List<string>();
if (quiet)
if (!args.Any(s => s.Equals("--verbosity", StringComparison.OrdinalIgnoreCase) || s.Equals("-v", StringComparison.OrdinalIgnoreCase)))
{
prefixArgs.Add("--verbosity");
prefixArgs.Add("Error");
prefixArgs.Add("minimal");
}
prefixArgs.Add("restore");

View file

@ -24,16 +24,12 @@ namespace Microsoft.DotNet.Tools.Restore
Description = "Restores dependencies listed in project.json"
};
// Parse --quiet, because we have to handle that specially since NuGet3 has a different
// "--verbosity" switch that goes BEFORE the command
var quiet = args.Any(s => s.Equals("--quiet", StringComparison.OrdinalIgnoreCase));
args = args.Where(s => !s.Equals("--quiet", StringComparison.OrdinalIgnoreCase)).ToArray();
app.OnExecute(() =>
{
try
{
return NuGet3.Restore(args, quiet);
return NuGet3.Restore(args);
}
catch (InvalidOperationException e)
{

View file

@ -218,7 +218,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
Directory.SetCurrentDirectory(RestoredTestProjectDirectory);
new NewCommand().Execute().Should().Pass();
new RestoreCommand().Execute("--quiet").Should().Pass();
new RestoreCommand().Execute().Should().Pass();
Directory.SetCurrentDirectory(currentDirectory);
}

View file

@ -81,7 +81,7 @@ namespace Microsoft.DotNet.Tests.Performance
var restoreCommand = new RestoreCommand();
restoreCommand.WorkingDirectory = RestoredTestProjectDirectory;
restoreCommand.Execute("--quiet").Should().Pass();
restoreCommand.Execute().Should().Pass();
}
}
}