Skip to content

Commit b43dee2

Browse files
committed
(chocolatey#886) Add packages.config elements for more global arguments
This some more arguments in the global OptionSet as elements to the packages.config xml serialization schema. This is useful for users wanting arguments that were previously not available. It is also a pre-requisite for exporting remembered arguments, as some of the remembered arguments were not available in the previous available schema.
1 parent 6c72f03 commit b43dee2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,25 @@ public sealed class PackagesConfigFilePackageSetting
138138
[XmlAttribute(AttributeName = "disableRepositoryOptimizations")]
139139
public bool DisableRepositoryOptimizations { get; set; }
140140

141+
[XmlAttribute(AttributeName = "acceptLicense")]
142+
public bool AcceptLicense { get; set; }
143+
144+
[XmlAttribute(AttributeName = "confirm")]
145+
public bool Confirm { get; set; }
146+
147+
[XmlAttribute(AttributeName = "limitOutput")]
148+
public bool LimitOutput { get; set; }
149+
150+
[XmlAttribute(AttributeName = "cacheLocation")]
151+
public string CacheLocation { get; set; }
152+
153+
[XmlAttribute(AttributeName = "failOnStderr")]
154+
public bool FailOnStderr { get; set; }
155+
156+
[XmlAttribute(AttributeName = "useSystemPowershell")]
157+
public bool UseSystemPowershell { get; set; }
158+
159+
[XmlAttribute(AttributeName = "noProgress")]
160+
public bool NoProgress { get; set; }
141161
}
142162
}

src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,17 @@ private IEnumerable<ChocolateyConfiguration> get_packages_from_config(string pac
767767
if (pkgSettings.ExitWhenRebootDetected) packageConfig.Features.ExitOnRebootDetected = true;
768768
if (pkgSettings.IgnoreDetectedReboot) packageConfig.Features.ExitOnRebootDetected = false;
769769
if (pkgSettings.DisableRepositoryOptimizations) packageConfig.Features.UsePackageRepositoryOptimizations = false;
770+
if (pkgSettings.AcceptLicense) packageConfig.AcceptLicense = true;
771+
if (pkgSettings.Confirm)
772+
{
773+
packageConfig.PromptForConfirmation = false;
774+
packageConfig.AcceptLicense = true;
775+
}
776+
if (pkgSettings.LimitOutput) packageConfig.RegularOutput = false;
777+
packageConfig.CacheLocation = string.IsNullOrWhiteSpace(pkgSettings.CacheLocation) ? packageConfig.CacheLocation : pkgSettings.CacheLocation;
778+
if (pkgSettings.FailOnStderr) packageConfig.Features.FailOnStandardError = true;
779+
if (pkgSettings.UseSystemPowershell) packageConfig.Features.UsePowerShellHost = false;
780+
if (pkgSettings.NoProgress) packageConfig.Features.ShowDownloadProgress = false;
770781

771782
this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(packageConfig.PackageNames));
772783
packageConfigs.Add(packageConfig);

0 commit comments

Comments
 (0)