Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chocolatey#886) Add packages.config elements for more global arguments
Browse files Browse the repository at this point in the history
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.
TheCakeIsNaOH committed Jun 27, 2022
1 parent e1a146e commit 356c48a
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -138,5 +138,25 @@ public sealed class PackagesConfigFilePackageSetting
[XmlAttribute(AttributeName = "disableRepositoryOptimizations")]
public bool DisableRepositoryOptimizations { get; set; }

[XmlAttribute(AttributeName = "acceptLicense")]
public bool AcceptLicense { get; set; }

[XmlAttribute(AttributeName = "confirm")]
public bool Confirm { get; set; }

[XmlAttribute(AttributeName = "limitOutput")]
public bool LimitOutput { get; set; }

[XmlAttribute(AttributeName = "cacheLocation")]
public string CacheLocation { get; set; }

[XmlAttribute(AttributeName = "failOnStderr")]
public bool FailOnStderr { get; set; }

[XmlAttribute(AttributeName = "useSystemPowershell")]
public bool UseSystemPowershell { get; set; }

[XmlAttribute(AttributeName = "noProgress")]
public bool NoProgress { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -767,6 +767,17 @@ private IEnumerable<ChocolateyConfiguration> get_packages_from_config(string pac
if (pkgSettings.ExitWhenRebootDetected) packageConfig.Features.ExitOnRebootDetected = true;
if (pkgSettings.IgnoreDetectedReboot) packageConfig.Features.ExitOnRebootDetected = false;
if (pkgSettings.DisableRepositoryOptimizations) packageConfig.Features.UsePackageRepositoryOptimizations = false;
if (pkgSettings.AcceptLicense) packageConfig.AcceptLicense = true;
if (pkgSettings.Confirm)
{
packageConfig.PromptForConfirmation = false;
packageConfig.AcceptLicense = true;
}
if (pkgSettings.LimitOutput) packageConfig.RegularOutput = false;
packageConfig.CacheLocation = string.IsNullOrWhiteSpace(pkgSettings.CacheLocation) ? packageConfig.CacheLocation : pkgSettings.CacheLocation;
if (pkgSettings.FailOnStderr) packageConfig.Features.FailOnStandardError = true;
if (pkgSettings.UseSystemPowershell) packageConfig.Features.UsePowerShellHost = false;
if (pkgSettings.NoProgress) packageConfig.Features.ShowDownloadProgress = false;

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

0 comments on commit 356c48a

Please sign in to comment.