From 36f71828ea874d572b85c01007632de40622e7ff Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sun, 26 May 2019 18:12:49 -0500 Subject: [PATCH] (GH-1831) list/search/info - disabe repo opts switch Ensure that when running search, list, or info, there is a switch to disable the repository optimizations when they are not available. --- .../commands/ChocolateyInfoCommand.cs | 10 ++++++++++ .../commands/ChocolateyListCommand.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index 9dcbb7a5ca..c94f0d1ecd 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -63,6 +63,16 @@ public override void configure_argument_parser(OptionSet optionSet, ChocolateyCo .Add("cp=|certpassword=", "Certificate Password - the client certificate's password to the source. Defaults to empty. Available in 0.9.10+.", option => configuration.SourceCommand.CertificatePassword = option.remove_surrounding_quotes()) + .Add("disable-repository-optimizations|disable-package-repository-optimizations", + "Disable Package Repository Optimizations - Do not use optimizations for reducing bandwidth with repository queries during package install/upgrade/outdated operations. Should not generally be used, unless a repository needs to support older methods of query. When used, this makes queries similar to the way they were done in Chocolatey v0.10.11 and before. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.14+.".format_with + (ApplicationParameters.Features.UsePackageRepositoryOptimizations, configuration.Features.UsePackageRepositoryOptimizations.to_string()), + option => + { + if (option != null) + { + configuration.Features.UsePackageRepositoryOptimizations = false; + } + }) ; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index d3eea3127c..37d3f6806b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -119,6 +119,16 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon .Add("detail|detailed", "Detailed - Alias for verbose. Available in 0.9.10+.", option => configuration.Verbose = option != null) + .Add("disable-repository-optimizations|disable-package-repository-optimizations", + "Disable Package Repository Optimizations - Do not use optimizations for reducing bandwidth with repository queries during package install/upgrade/outdated operations. Should not generally be used, unless a repository needs to support older methods of query. When disabled, this makes queries similar to the way they were done in Chocolatey v0.10.11 and before. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.14+.".format_with + (ApplicationParameters.Features.UsePackageRepositoryOptimizations, configuration.Features.UsePackageRepositoryOptimizations.to_string()), + option => + { + if (option != null) + { + configuration.Features.UsePackageRepositoryOptimizations = false; + } + }) ; }