chocolatey/chocolatey — pull request #418 by jberezanski (2014-02-14 20:37:56+00:00)
Title: Fix removing batch redirects when uninstalling a package

Currently, when a package is uninstalled, instead of removing batch redirect files from $Env:ChocolateyInstall\bin, Chocolatey recreates them (acts as if the package was being installed).

This happens because the "uninstall" switch is being passed to Get-ChocolateyBins incorrectly (bug introduced by commit b12e91bf "add error level checking to chocolatey install process (nuget)").

That commit wrapped the Get-ChocolateyBins call with Invoke-ChocolateyFunction, but passed the parameter values wrapped in an array, which works for positional parameters only. The solution is to use a hashtable (a good practice anyway, since the code is more maintainable).

As a side note, apart from (now a bit improved) logging of parameter values for diagnostic purposes, Invoke-ChocolateyFunction does not seem to add any other value, but only introduces complexity, possibility of bugs and prevents IntelliSense when editing the scripts. I'd gladly see it removed.