jdhitsolutions / PSScriptTools

:wrench: :hammer: A set of PowerShell functions you might use to enhance your own functions and scripts or to facilitate working in the console. Most should work in both Windows PowerShell and PowerShell 7, even cross-platform. Any operating system limitations should be handled on a per command basis. The Samples folder contains demonstration script files
MIT License
875 stars 110 forks source link

`Get-ParameterInfo` misses `IsDynamic` parameters on aliases #101

Closed ninmonkey closed 3 years ago

ninmonkey commented 3 years ago

Describe the bug Get-ParameterInfo misses IsDynamic parameters when using the alias name.

To Reproduce

PS> Get-ParameterInfo gc | ft Name, Aliases, IsDynamic, Type

Name        Aliases    IsDynamic Type
----        -------    --------- ----
ReadCount                  False System.Int64
TotalCount  First,Head     False System.Int64
Tail        Last           False System.Int32
Path                       False System.String[]
LiteralPath PSPath,LP      False System.String[]
Filter                     False System.String
Include                    False System.String[]
Exclude                    False System.String[]
Force                      False System.Management.Automation.SwitchParameter
Credential                 False System.Management.Automation.PSCredential

Expected behavior

PS> Get-ParameterInfo Get-Content | ft Name, Aliases, IsDynamic, Type

Name         Aliases    IsDynamic Type
----         -------    --------- ----
ReadCount                   False System.Int64
TotalCount   First,Head     False System.Int64
Tail         Last           False System.Int32
Path                        False System.String[]
LiteralPath  PSPath,LP      False System.String[]
Filter                      False System.String
Include                     False System.String[]
Exclude                     False System.String[]
Force                       False System.Management.Automation.SwitchParameter
Credential                  False System.Management.Automation.PSCredential
Delimiter                    True System.String
Wait                         True System.Management.Automation.SwitchParameter
Raw                          True System.Management.Automation.SwitchParameter
Encoding                     True System.Text.Encoding
AsByteStream                 True System.Management.Automation.SwitchParameter
Stream                       True System.String

Desktop (please complete the following information):

jdhitsolutions commented 3 years ago

That is an interesting bug.

jdhitsolutions commented 3 years ago

Not too difficult to fix. Working on a new release. Of course, the workaround, for now, is to use the command name and not an alias.

jdhitsolutions commented 3 years ago

This should be fixed in v2.34.1.