diff --git a/docs/generated/HelpersGetPackageParameters.md b/docs/generated/HelpersGetPackageParameters.md index e060e3f7f5..cd3baa0b1e 100644 --- a/docs/generated/HelpersGetPackageParameters.md +++ b/docs/generated/HelpersGetPackageParameters.md @@ -78,8 +78,9 @@ if (!$pp['LICENSE']) { $pp['LICENSE'] = '1234' } ~~~powershell $pp = Get-PackageParameters -# Requires 0.10.8 for Read-Host -AsSecureString -if (!$pp['Password']) { $pp['Password'] = Read-Host "Enter password for $userName:" -AsSecureString} +if (!$pp['UserName']) { $pp['UserName'] = "$env:UserName" } +# Requires Choocolatey v0.10.8+ for Read-Host -AsSecureString +if (!$pp['Password']) { $pp['Password'] = Read-Host "Enter password for $($pp['UserName']):" -AsSecureString} # fail the install/upgrade if not value is not determined if (!$pp['Password']) { throw "Package needs Password to install, that must be provided in params or in prompt." } ~~~ @@ -114,7 +115,7 @@ compatibility with `chocolatey-core.extension`, use `:`. For example `-Parameters "/ITEM1:value /ITEM2:value with spaces" -NOTE: In 0.10.9+, to maintain compatibility with the prior art of the +NOTE: In 0.10.9+, to maintain compatibility with the prior art of the chocolatey-core.extension method, quotes and apostrophes surrounding parameter values will be removed. When the param is used, those items can be added back if desired, but it's most important to ensure that diff --git a/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 b/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 index 053c2a8649..7fddc410f1 100644 --- a/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 @@ -67,7 +67,7 @@ compatibility with `chocolatey-core.extension`, use `:`. For example `-Parameters "/ITEM1:value /ITEM2:value with spaces" -NOTE: In 0.10.9+, to maintain compatibility with the prior art of the +NOTE: In 0.10.9+, to maintain compatibility with the prior art of the chocolatey-core.extension method, quotes and apostrophes surrounding parameter values will be removed. When the param is used, those items can be added back if desired, but it's most important to ensure that @@ -100,12 +100,12 @@ if (!$pp['LICENSE']) { $pp['LICENSE'] = '1234' } .EXAMPLE > $pp = Get-PackageParameters -# Requires 0.10.8 for Read-Host -AsSecureString -if (!$pp['Password']) { $pp['Password'] = Read-Host "Enter password for $userName:" -AsSecureString} +if (!$pp['UserName']) { $pp['UserName'] = "$env:UserName" } +# Requires Choocolatey v0.10.8+ for Read-Host -AsSecureString +if (!$pp['Password']) { $pp['Password'] = Read-Host "Enter password for $($pp['UserName']):" -AsSecureString} # fail the install/upgrade if not value is not determined if (!$pp['Password']) { throw "Package needs Password to install, that must be provided in params or in prompt." } - .EXAMPLE > # Pass in your own values