Closed warsus closed 3 years ago
Using null or empty parameters isn't really a PowerShell way of doing things. My suggestion would be to check the value of the parameter and then using the cChocoPackageInstaller
block with the correct parameters depending on the situation.
I don't agree with the sentiment about null and empty parameters and i think the resulting duplication of code is unnecessary, but i think i can deal with it. Thanks for the feedback!
Write-Host $null
;-)
I have a package where i may or may not need to add parameters depending on the desired configuration more or less dynamically. Now if i don't need any parameter (it might be $null or an empty string) i have to omit the
Params
parameter completely, since its not allowed to be null or empty. So a possible solution would be this (maybe there's something better that i'm missing).I would like it if i can put a null or empty value into the
Params
argument ofcChocoPackageInstall
So the above would simplify naturally to: