indented-automation / Indented.StubCommand

MIT License
23 stars 4 forks source link

DefaultParameterSetName #7

Closed fsackur closed 7 years ago

fsackur commented 7 years ago

My use case is writing proxy commands, but I think this applies to other use cases.

Consider the invocation "Get-WmiObject -Class Win32_ComputerSystem"

Microsoft.PowerShell.Management\Get-WmiObject returns with this call. The generated stub command for Get-WmiObject throws "Parameter set cannot be resolved using the specified named parameters."

I think this is because of DefaultParameterSetName not being implemented.

indented-automation commented 7 years ago

I concur, I can see how I ended up there. Thank you :)

On 14 April 2017 at 13:31, Freddie Sackur notifications@github.com wrote:

My use case is writing proxy commands, but I think this applies to other use cases.

Consider the invocation "Get-WmiObject -Class Win32_ComputerSystem"

Microsoft.PowerShell.Management\Get-WmiObject returns with this call. The generated stub command for Get-WmiObject throws "Parameter set cannot be resolved using the specified named parameters."

I think this is because of DefaultParameterSetName not being implemented.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/indented-automation/Indented.StubCommand/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AMO6DsBLQ3u6Yddk6xdc0osJ95x5cRqaks5rv2cggaJpZM4M9tZi .

indented-automation commented 7 years ago

I don't think so, the generated proxy should have a CmdletBinding attribute. It doesn't because CmdletInfo doesn't appear to fill the CmdletBinding property inherited from CommandInfo (as a boolean).

On 14 April 2017 at 13:35, Freddie Sackur notifications@github.com wrote:

Hold on, mistake at my end! I think I mucked up a copy-n-paste

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/indented-automation/Indented.StubCommand/issues/7#issuecomment-294146540, or mute the thread https://github.com/notifications/unsubscribe-auth/AMO6Dld6pMYzPMmeQ7K-DDmJVLnuG58Pks5rv2gqgaJpZM4M9tZi .

fsackur commented 7 years ago

$COmmandInfo = Get-command Get-WmiObject

This doesn't appear to to be set: $CommandInfo.CmdletBinding

indented-automation commented 7 years ago

Thank you. Fixed in 1.1. Pushed to releases, pushed to PSGallery.

On 14 April 2017 at 13:37, Freddie Sackur notifications@github.com wrote:

$COmmandInfo = Get-command Get-WmiObject

This doesn't appear to to be set: $CommandInfo.CmdletBinding

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/indented-automation/Indented.StubCommand/issues/7#issuecomment-294146742, or mute the thread https://github.com/notifications/unsubscribe-auth/AMO6DnBz02gaI007rpkrgUzawQLG0zuWks5rv2iZgaJpZM4M9tZi .