Skip to content

Commit

Permalink
(#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.
  • Loading branch information
TheCakeIsNaOH committed Jun 27, 2022
1 parent 1951ccd commit 2e400c9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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);
Expand Down

0 comments on commit 2e400c9

Please sign in to comment.