Skip to content

Commit

Permalink
(chocolatey-archive#159) passing parameters to packages changed to st…
Browse files Browse the repository at this point in the history
…ring

This now matches with the same as the installer args. Anything is allowed to be
passed in. Both will convert '' to " inside of '' - e.g. -params 'value1=''this
   value''; value2=2'
  • Loading branch information
ferventcoder committed Nov 11, 2013
1 parent f98230a commit 223f370
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[string] $name,
[switch] $ignoreDependencies = $false,
[alias("x86")][switch] $forceX86 = $false,
[alias("params")][alias("parameters")][alias("pkgParams")][hashtable]$packageParameters = @{},
[alias("params")][alias("parameters")][alias("pkgParams")][string]$packageParameters = '',
[parameter(Position=1, ValueFromRemainingArguments=$true)]
[string[]]$packageNames=@('')
)
Expand Down Expand Up @@ -112,12 +112,18 @@ if ([Environment]::OSVersion.Version -lt (new-object 'Version' 6,0)){
$source = $originalSource
}

# bump installarguments back to quotes
$installArguments = $installArguments.Replace("'","""")
$packageParameters = $packageParameters.Replace("'","""")


#main entry point
Append-Log

Write-Debug "Arguments: `$command = '$command'|`$packageNames='$packageNames'|`$source='$source'|`$version='$version'|`$allVersions=$allVersions|`$InstallArguments='$installArguments'|`$overrideArguments=$overrideArgs|`$force=$force|`$prerelease=$prerelease|`$localonly=$localonly|`$verbosity=$verbosity|`$debug=$debug|`$name='$name'|`$ignoreDependencies=$ignoreDependencies|`$forceX86=$forceX86|`$packageParameters='$($packageParameters.GetEnumerator() | % {"$($_.Name)=$($_.Value)"})'"
Write-Debug "Arguments: `$command = '$command'|`$packageNames='$packageNames'|`$source='$source'|`$version='$version'|`$allVersions=$allVersions|`$InstallArguments='$installArguments'|`$overrideArguments=$overrideArgs|`$force=$force|`$prerelease=$prerelease|`$localonly=$localonly|`$verbosity=$verbosity|`$debug=$debug|`$name='$name'|`$ignoreDependencies=$ignoreDependencies|`$forceX86=$forceX86|`$packageParameters='$packageParameters'|PowerShellVersion=$($host.version)"

# run level environment variables

# run level environment variables
$env:chocolateyForceX86 = $null
if ($forceX86) {
$env:chocolateyForceX86 = $true
Expand Down

0 comments on commit 223f370

Please sign in to comment.