Skip to content

Commit

Permalink
(chocolateyGH-1398) outdated: ignore unfound
Browse files Browse the repository at this point in the history
If a package is not found on a source when checking for newer versions,
allow keeping it out of the results. This allows to limit results down
to a particular source.
  • Loading branch information
ferventcoder committed Sep 7, 2017
1 parent a2ce6b4 commit d677e5d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon
option => configuration.SourceCommand.CertificatePassword = option.remove_surrounding_quotes())
.Add("ignore-pinned",
"Ignore Pinned - Ignore pinned packages. Defaults to false. Available in 0.10.6+.",
option => configuration.OutdatedCommand.IgnorePinned = option != null)
option => configuration.OutdatedCommand.IgnorePinned = option != null)
.Add("ignore-unfound",
"Ignore Unfound Packages - Ignore packages that are not found on the sources used (or the defaults). Defaults to false. Available in 0.10.9+.",
option => configuration.OutdatedCommand.IgnoreUnfoundPackages = option != null)
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ public sealed class PinCommandConfiguration
public sealed class OutdatedCommandConfiguration
{
public bool IgnorePinned { get; set; }
public bool IgnoreUnfoundPackages { get; set; }
}

[Serializable]
Expand Down
2 changes: 2 additions & 0 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ public ConcurrentDictionary<string, PackageResult> upgrade_run(ChocolateyConfigu

if (availablePackage == null)
{
if (config.OutdatedCommand.IgnoreUnfoundPackages) continue;

string logMessage = "{0} was not found with the source(s) listed.{1} If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.{1} Version: \"{2}\"; Source(s): \"{3}\"".format_with(packageName, Environment.NewLine, config.Version, config.Sources);
var unfoundResult = packageInstalls.GetOrAdd(packageName, new PackageResult(packageName, version.to_string(), null));

Expand Down

0 comments on commit d677e5d

Please sign in to comment.