Skip to content

Commit

Permalink
Merge pull request chocolatey#3140 from gep13/warn-about-filtering
Browse files Browse the repository at this point in the history
(chocolatey#508) Add warning about filtering of packages
  • Loading branch information
gep13 authored May 3, 2023
2 parents b18e1ee + 77f8d98 commit 97792a7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ public virtual IEnumerable<PackageResult> List(ChocolateyConfiguration config)
}
}

if ((config.ListCommand.ApprovedOnly || config.ListCommand.DownloadCacheAvailable || config.ListCommand.NotBroken) && config.RegularOutput)
{
// This warning has been added here, to provide context to the user, and a follow up issue

// has been added here: https://github.com/chocolatey/choco/issues/3139 to address the actual
// issue that causes this warning to be required.
this.Log().Warn(@"
Starting vith Chocolatey CLI v2.0.0, changes have been made to the
`choco search` command which means that filtering of packages using the
`--approved-only`, `--download-cache`, and `--not-broken` options are
now performed within Chocolatey CLI. Previously, this filtering would
have been performed on the Chocolatey Community Repository. As a result,
it is possible that incomplete package lists are returned from a command
that uses these options.");
}

if (config.RegularOutput) this.Log().Debug(() => "Running list with the following filter = '{0}'".FormatWith(config.Input));
if (config.RegularOutput) this.Log().Debug(ChocolateyLoggers.Verbose, () => "--- Start of List ---");
foreach (var pkg in NugetList.GetPackages(config, _nugetLogger, _fileSystem))
Expand Down

0 comments on commit 97792a7

Please # to comment.