Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
"kpm restore --quiet" hides HTTP requests/cache information
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengTian committed Aug 26, 2014
1 parent fe1006f commit 8081af8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/Microsoft.Framework.PackageManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public int Main(string[] args)
CommandOptionType.SingleValue);
var optNoCache = c.Option("--no-cache", "Do not use local cache", CommandOptionType.NoValue);
var optPackageFolder = c.Option("--packages", "Path to restore packages", CommandOptionType.SingleValue);
var optQuiet = c.Option("--quiet", "Do not show output such as HTTP request/cache information",
CommandOptionType.NoValue);
c.HelpOption("-?|-h|--help");
c.OnExecute(async () =>
Expand All @@ -72,6 +74,10 @@ public int Main(string[] args)
Information = this,
Verbose = optionVerbose.HasValue() ? (this as IReport) : new NullReport()
};
// If "--verbose" and "--quiet" are specified together, "--verbose" wins
command.Reports.Quiet = optQuiet.HasValue() ? command.Reports.Verbose : this;
command.RestoreDirectory = argRoot.Value;
command.Sources = optSource.Values;
command.FallbackSources = optFallbackSource.Values;
Expand Down Expand Up @@ -356,14 +362,14 @@ private static string GetVersion()
var assemblyInformationalVersionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
return assemblyInformationalVersionAttribute.InformationalVersion;
}
}

internal class NullReport : IReport
{
public void WriteLine(string message)
private class NullReport : IReport
{
// Consume the write operation and do nothing
// Used when verbose option is not specified
public void WriteLine(string message)
{
// Consume the write operation and do nothing
// Used when verbose option is not specified
}
}
}
}
1 change: 1 addition & 0 deletions src/Microsoft.Framework.PackageManager/Reports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ public class Reports
{
public IReport Information { get; set; }
public IReport Verbose { get; set; }
public IReport Quiet { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private void AddRemoteProvidersFromSources(List<IWalkProvider> remoteProviders,
new RemoteWalkProvider(
new PackageFolder(
source.Source,
Reports.Information)));
Reports.Quiet)));
}
else
{
Expand All @@ -431,7 +431,7 @@ private void AddRemoteProvidersFromSources(List<IWalkProvider> remoteProviders,
source.UserName,
source.Password,
NoCache,
Reports.Information)));
Reports.Quiet)));
}
}
}
Expand Down

0 comments on commit 8081af8

Please sign in to comment.