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

"kpm restore --quiet" hides HTTP requests/cache information #578

Merged
merged 1 commit into from
Aug 27, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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