Rename -Not parameter to -IsNullOrEmpty in Where-Object cmdlet.#6797
Rename -Not parameter to -IsNullOrEmpty in Where-Object cmdlet.#6797sethvs wants to merge 2 commits intoPowerShell:masterfrom
Conversation
|
Test-Connection.TraceRoute.TraceRoute works AppVeyor test failed. |
|
|
|
No, [pscustomobject] @{ Foo = $False } | Where-Object -Not Foo # OK, passes the input object through |
|
@mklement0 Agree, -IsNullOrEmpty is not ideal for [bool], but -Not has far wider meaning. So I think there should be better parameter name. |
|
I believe -IsFalseNullOrEmpty sounds horribly :) |
|
|
|
I agree with @mklement0. [pscustomobject] @{ Foo = 0 } | Where-Object -Not FooI don't see a problem with |
|
Sorry for creating confusion: in #6796 (comment) I was speaking in the abstract, giving general advice: you shouldn't just rename existing parameters, because that is a breaking change; if appropriate, a parameter alias can be implemented - but I do not think that that is appropriate here, for the reasons stated by me earlier and also by @iSazonov and @daxian-dbw. Note that The With strings, You can think of |
|
OK. |
PR Summary
-Not parameter is very ambiguous.
Is it better to rename it to -IsNullOrEmpty?
Also, ParameterSetName is changed to 'IsNullOrEmpty'.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests