Reduce nuget output
This addresses part of #1623. Unfortunately, because the CLI takes Nuget as a binary, it is hard to get to where I think we should really be. This change makes default verbosity "minimal", which is the first level where you get any status output. Unfortunately, things like package downgrade warnings and the like still appear there. This does hide all the "info" and "trace" messages by default. I also removed the now useless (and previously undocumented) --quiet.
This commit is contained in:
parent
62afa28de4
commit
785cab3072
4 changed files with 6 additions and 10 deletions
|
@ -10,13 +10,13 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
{
|
{
|
||||||
internal static class NuGet3
|
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>();
|
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("--verbosity");
|
||||||
prefixArgs.Add("Error");
|
prefixArgs.Add("minimal");
|
||||||
}
|
}
|
||||||
prefixArgs.Add("restore");
|
prefixArgs.Add("restore");
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,12 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
Description = "Restores dependencies listed in project.json"
|
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(() =>
|
app.OnExecute(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return NuGet3.Restore(args, quiet);
|
return NuGet3.Restore(args);
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException e)
|
catch (InvalidOperationException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -218,7 +218,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
||||||
Directory.SetCurrentDirectory(RestoredTestProjectDirectory);
|
Directory.SetCurrentDirectory(RestoredTestProjectDirectory);
|
||||||
|
|
||||||
new NewCommand().Execute().Should().Pass();
|
new NewCommand().Execute().Should().Pass();
|
||||||
new RestoreCommand().Execute("--quiet").Should().Pass();
|
new RestoreCommand().Execute().Should().Pass();
|
||||||
|
|
||||||
Directory.SetCurrentDirectory(currentDirectory);
|
Directory.SetCurrentDirectory(currentDirectory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace Microsoft.DotNet.Tests.Performance
|
||||||
|
|
||||||
var restoreCommand = new RestoreCommand();
|
var restoreCommand = new RestoreCommand();
|
||||||
restoreCommand.WorkingDirectory = RestoredTestProjectDirectory;
|
restoreCommand.WorkingDirectory = RestoredTestProjectDirectory;
|
||||||
restoreCommand.Execute("--quiet").Should().Pass();
|
restoreCommand.Execute().Should().Pass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue