Make parameter ValueFromPipelineByPropertyName
default to $true
.
Though, I'm not sure it won't cause hardship in some cases.
At least it seems rational and compelling.
It does seem rational and compelling to begin with.
However. Because you don't know what objects might be piped into a command you don't know what might use a command parameter name as a property name. This would cause some objects to fail while others worked, and command the failure might be very subtle. e.g. I pipe objects which have "Start" or "end" as a property into a command and the values for "Start and End" parameters are now set which they weren't before.
Yep. Typically there are only a few parameters which can be meaningfully used in a pipeline context when handling input.
There's a lot more to making a parameter work with the pipeline than _just_ the attribute. You have to code the function or cmdlet in a way that actually works with the pipeline, being sure to use the value in the process{}
/ ProcessRecord()
areas and not the begin / end areas, where pipeline parameter values are not guaranteed to be defined.
It's opt-in because you have to specifically code the function or cmdlet to operate correctly and expect the values to be set at specific points; you can't just add the attribute and expect it to work automatically. As a result, making it opt-out and not opt-in would most likely just break quite a few commands rather than improving things. 馃檪
Most helpful comment
Yep. Typically there are only a few parameters which can be meaningfully used in a pipeline context when handling input.
There's a lot more to making a parameter work with the pipeline than _just_ the attribute. You have to code the function or cmdlet in a way that actually works with the pipeline, being sure to use the value in the
process{}
/ProcessRecord()
areas and not the begin / end areas, where pipeline parameter values are not guaranteed to be defined.It's opt-in because you have to specifically code the function or cmdlet to operate correctly and expect the values to be set at specific points; you can't just add the attribute and expect it to work automatically. As a result, making it opt-out and not opt-in would most likely just break quite a few commands rather than improving things. 馃檪