|
1 | | -#region Piecemeal [ 0.3.5 ] : Easy Extensible Plugins for PowerShell |
| 1 | +#region Piecemeal [ 0.3.6 ] : Easy Extensible Plugins for PowerShell |
2 | 2 | # Install-Module Piecemeal -Scope CurrentUser |
3 | 3 | # Import-Module Piecemeal -Force |
4 | 4 | # Install-Piecemeal -ExtensionNoun 'Transpiler' -ExtensionPattern '\.psx\.ps1$' -ExtensionTypeName 'PipeScript.Transpiler' -OutputPath '.\Get-Transpiler.ps1' |
@@ -602,11 +602,20 @@ function Get-Transpiler |
602 | 602 | $params = @{} |
603 | 603 | $mappedParams = [Ordered]@{} # Create a collection of mapped parameters |
604 | 604 | # Walk thru each parameter of this command |
605 | | - foreach ($myParam in $paramSet.Parameters) { |
| 605 | + :nextParameter foreach ($myParam in $paramSet.Parameters) { |
606 | 606 | # If the parameter is ValueFromPipeline |
607 | 607 | if ($myParam.ValueFromPipeline) { |
| 608 | + $potentialPSTypeNames = @($myParam.Attributes.PSTypeName) -ne '' |
| 609 | + if ($potentialPSTypeNames) { |
| 610 | + foreach ($potentialTypeName in $potentialPSTypeNames) { |
| 611 | + if ($potentialTypeName -and $InputObject.pstypenames -contains $potentialTypeName) { |
| 612 | + $mappedParams[$myParam.Name] = $params[$myParam.Name] = $InputObject |
| 613 | + continue nextParameter |
| 614 | + } |
| 615 | + } |
| 616 | + } |
608 | 617 | # and we have an input object |
609 | | - if ($null -ne $inputObject -and |
| 618 | + elseif ($null -ne $inputObject -and |
610 | 619 | ( |
611 | 620 | # of the exact type |
612 | 621 | $myParam.ParameterType -eq $inputObject.GetType() -or |
@@ -925,5 +934,5 @@ function Get-Transpiler |
925 | 934 | } |
926 | 935 | } |
927 | 936 | } |
928 | | -#endregion Piecemeal [ 0.3.5 ] : Easy Extensible Plugins for PowerShell |
| 937 | +#endregion Piecemeal [ 0.3.6 ] : Easy Extensible Plugins for PowerShell |
929 | 938 |
|
0 commit comments