ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
36 stars 4 forks source link

Add -Value switch to Get-UDElement #1994

Closed MikeShepard closed 1 year ago

MikeShepard commented 1 year ago

Summary of the new feature / enhancement

As a developer, 9 times out of 10 when I use Get-UDElement, I'm doing that to get the value.

Instead of (Get-UDElement -id TheElement).Value, I'd like to be able to do Get-UDElement -ID TheElement -Value, avoiding the need for extra parentheses.

this is similar to Get-Variable, which has a -ValueOnly switch.

Proposed technical implementation details (optional)

If -Value is present, output the value property only.

adamdriscoll commented 1 year ago

I might suggest a -Property parameter instead. If we make it positional, it will still have the shortened syntax you're looking for.

Get-UDElement -Id myElement -Property value
Get-UDElement myElement value
MikeShepard commented 1 year ago

Either way works, just needing a parenthesised expression is too much.

On Wed, Jan 25, 2023 at 12:14 PM Adam Driscoll @.***> wrote:

I might suggest a -Property parameter instead. If we make it positional, it will still have the shortened syntax you're looking for.

Get-UDElement -Id myElement -Property value Get-UDElement myElement value

— Reply to this email directly, view it on GitHub https://github.com/ironmansoftware/issues/issues/1994#issuecomment-1404033274, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKI2IUBOHPVFU3JDU7FXCLWUFUPTANCNFSM6AAAAAAUGSRSSY . You are receiving this because you authored the thread.Message ID: @.***>

-- https://powershellstation.com