@@ -2132,19 +2132,12 @@ function MyGetCommand
21322132 }
21332133 }
21342134
2135- # This Select-Object -Skip | Select-Object -SkipLast
2136- # looks a little crazy, but this is just a workaround for
2137- # https://github.com/PowerShell/PowerShell/issues/6979
2138- # -First and -Index breaks the subsequent Get-Help calls
2139-
21402135 # expand second layer of properties on the selected item
2141- function expand2 ([string ]$property1 , [int ]$num , [int ]$totalNum , [string ]$property2 ) {
2142- $skipLast = $totalNum - $num - 1
2136+ function expand2 ([string ]$property1 , [int ]$num , [string ]$property2 ) {
21432137 Invoke-Command - Session $Session - ScriptBlock {
21442138 Get-Command $using :Cmdlet |
21452139 Select-Object - ExpandProperty $using :property1 |
2146- Select-Object - Skip $using :num |
2147- Select-Object - SkipLast $using :skipLast |
2140+ Select-Object - Index $using :num - Wait |
21482141 Select-Object - ExpandProperty $using :property2
21492142 }
21502143 }
@@ -2153,16 +2146,13 @@ function MyGetCommand
21532146 function expand3 (
21542147 [string ]$property1 ,
21552148 [int ]$num ,
2156- [int ]$totalNum ,
21572149 [string ]$property2 ,
21582150 [string ]$property3
21592151 ) {
2160- $skipLast = $totalNum - $num - 1
21612152 Invoke-Command - Session $Session - ScriptBlock {
21622153 Get-Command $using :Cmdlet |
21632154 Select-Object - ExpandProperty $using :property1 |
2164- Select-Object - Skip $using :num |
2165- Select-Object - SkipLast $using :skipLast |
2155+ Select-Object - Index $using :num - Wait |
21662156 Select-Object - ExpandProperty $using :property2 |
21672157 Select-Object - ExpandProperty $using :property3
21682158 }
@@ -2173,11 +2163,11 @@ function MyGetCommand
21732163 }
21742164
21752165 # helper function to fill up the parameters metadata
2176- function getParams ([int ]$num , [ int ] $totalNum ) {
2166+ function getParams ([int ]$num ) {
21772167 # this call we need to fill-up ParameterSets.Parameters.ParameterType with metadata
2178- $parameterType = expand3 ' ParameterSets' $num $totalNum ' Parameters' ' ParameterType'
2168+ $parameterType = expand3 ' ParameterSets' $num ' Parameters' ' ParameterType'
21792169 # this call we need to fill-up ParameterSets.Parameters with metadata
2180- $parameters = expand2 ' ParameterSets' $num $totalNum ' Parameters'
2170+ $parameters = expand2 ' ParameterSets' $num ' Parameters'
21812171 if ($parameters.Length -ne $parameterType.Length ) {
21822172 $errStr = " Metadata for $Cmdlet doesn't match length.`n " +
21832173 " This should never happen! Please report the issue on https://github.com/PowerShell/platyPS/issues"
0 commit comments