From 17e0a8f6cac5d6a5842e448cc017416f46677f5a Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 5 Nov 2023 19:03:55 -0800 Subject: [PATCH] fix: CommandInfo.CouldPipeType Alias support (Fixes #560) --- Types/CommandInfo/CouldPipe.ps1 | 9 ++++++++- Types/CommandInfo/CouldPipeType.ps1 | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Types/CommandInfo/CouldPipe.ps1 b/Types/CommandInfo/CouldPipe.ps1 index f0b440229..49589a697 100644 --- a/Types/CommandInfo/CouldPipe.ps1 +++ b/Types/CommandInfo/CouldPipe.ps1 @@ -1,6 +1,13 @@ param([PSObject]$InputObject) -:nextParameterSet foreach ($paramSet in $this.ParameterSets) { +$parameterSets = + if ($this.ResolvedCommand.ParameterSets) { + $this.ResolvedCommand.ParameterSets + } elseif ($this.ParameterSets) { + $this.ParameterSets + } + +:nextParameterSet foreach ($paramSet in $parameterSets) { if ($ParameterSetName -and $paramSet.Name -ne $ParameterSetName) { continue } $params = @{} $mappedParams = [Ordered]@{} # Create a collection of mapped parameters diff --git a/Types/CommandInfo/CouldPipeType.ps1 b/Types/CommandInfo/CouldPipeType.ps1 index 5de226540..eb470d129 100644 --- a/Types/CommandInfo/CouldPipeType.ps1 +++ b/Types/CommandInfo/CouldPipeType.ps1 @@ -3,7 +3,14 @@ param( $Type ) -:nextParameterSet foreach ($paramSet in $this.ParameterSets) { +$parameterSets = + if ($this.ResolvedCommand.ParameterSets) { + $this.ResolvedCommand.ParameterSets + } elseif ($this.ParameterSets) { + $this.ParameterSets + } + +:nextParameterSet foreach ($paramSet in $parameterSets) { if ($ParameterSetName -and $paramSet.Name -ne $ParameterSetName) { continue } $params = @{} $mappedParams = [Ordered]@{} # Create a collection of mapped parameters