Skip to content

Commit

Permalink
(chocolatey-archive#159) Allow passing params to pkgs
Browse files Browse the repository at this point in the history
This is implemented as -params "@{name=value;name2=value2}"

This is quite naive and won't accept spaces of any sort. It must be passed in
the format shown above.
  • Loading branch information
ferventcoder committed Nov 9, 2013
1 parent eca2dee commit c68dd17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ BREAKING CHANGES:
FEATURES:

* Enhancement - Add switch to force x86 when packages have both versions - [#365](https://github.com/chocolatey/chocolatey/issues/365)
* Enhancement - Allow passing parameters to packages - [#159](https://github.com/chocolatey/chocolatey/issues/159)

IMPROVEMENTS:

Expand Down
1 change: 1 addition & 0 deletions nuget/chocolatey.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ BREAKING CHANGES:
FEATURES:

* Enhancement - Add switch to force x86 when packages have both versions - [#365](https://github.com/chocolatey/chocolatey/issues/365)
* Enhancement - Allow passing parameters to packages - [#159](https://github.com/chocolatey/chocolatey/issues/159)

IMPROVEMENTS:

Expand Down
4 changes: 3 additions & 1 deletion src/chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[string] $name,
[switch] $ignoreDependencies = $false,
[alias("x86")][switch] $forceX86 = $false,
[alias("params")][alias("parameters")][alias("pkgParams")][hashtable]$packageParameters = @{},
[parameter(Position=1, ValueFromRemainingArguments=$true)]
[string[]]$packageNames=@('')
)
Expand Down Expand Up @@ -114,14 +115,15 @@ if ([Environment]::OSVersion.Version -lt (new-object 'Version' 6,0)){
#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"
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)"})'"

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

$env:chocolateyPackageParameters = $packageParameters

$chocolateyErrored = $false
$badPackages = ''
Expand Down

0 comments on commit c68dd17

Please sign in to comment.