Skip to content

Commit

Permalink
(GH-759) Summarize affected pkgs when at least 5
Browse files Browse the repository at this point in the history
When installing from a packages.config, or upgrading/uninstalling all
packages, things can get lost in the information about things that were
successful. It's better to report this in a summary when there are more
than an easily scannable number of packages involved. When the number
is 5 or more, report the summary of affected packages.
  • Loading branch information
ferventcoder committed Jun 11, 2016
1 parent 0d7809e commit bfa6b1f
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ public ConcurrentDictionary<string, PackageResult> uninstall_run(ChocolateyConfi

private int report_action_summary(ConcurrentDictionary<string, PackageResult> packageResults, string actionName)
{
var successes = packageResults.or_empty_list_if_null().Where(p => p.Value.Success && !p.Value.Inconclusive);
var failures = packageResults.Count(p => !p.Value.Success);
var warnings = packageResults.Count(p => p.Value.Warning);
var rebootPackages = packageResults.Count(p => new[] { 1641, 3010 }.Contains(p.Value.ExitCode));
Expand All @@ -657,12 +658,23 @@ private int report_action_summary(ConcurrentDictionary<string, PackageResult> pa
Environment.NewLine,
ApplicationParameters.Name,
actionName,
packageResults.Count(p => p.Value.Success && !p.Value.Inconclusive),
successes.Count(),
packageResults.Count,
failures,
_fileSystem.combine_paths(ApplicationParameters.LoggingLocation, ApplicationParameters.LoggingFile)
));

// summarize results when more than 5
if (packageResults.Count >= 5 && successes.Count() != 0)
{
this.Log().Info("");
this.Log().Warn("{0}{1}:".format_with(actionName.Substring(0,1).ToUpper(), actionName.Substring(1)));
foreach (var packageResult in successes.or_empty_list_if_null())
{
this.Log().Info(" - {0} v{1}".format_with(packageResult.Value.Name, packageResult.Value.Version));
}
}

if (warnings != 0)
{
this.Log().Info("");
Expand Down

0 comments on commit bfa6b1f

Please sign in to comment.