@@ -2132,19 +2132,12 @@ function MyGetCommand
2132
2132
}
2133
2133
}
2134
2134
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
-
2140
2135
# 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 ) {
2143
2137
Invoke-Command - Session $Session - ScriptBlock {
2144
2138
Get-Command $using :Cmdlet |
2145
2139
Select-Object - ExpandProperty $using :property1 |
2146
- Select-Object - Skip $using :num |
2147
- Select-Object - SkipLast $using :skipLast |
2140
+ Select-Object - Index $using :num - Wait |
2148
2141
Select-Object - ExpandProperty $using :property2
2149
2142
}
2150
2143
}
@@ -2153,16 +2146,13 @@ function MyGetCommand
2153
2146
function expand3 (
2154
2147
[string ]$property1 ,
2155
2148
[int ]$num ,
2156
- [int ]$totalNum ,
2157
2149
[string ]$property2 ,
2158
2150
[string ]$property3
2159
2151
) {
2160
- $skipLast = $totalNum - $num - 1
2161
2152
Invoke-Command - Session $Session - ScriptBlock {
2162
2153
Get-Command $using :Cmdlet |
2163
2154
Select-Object - ExpandProperty $using :property1 |
2164
- Select-Object - Skip $using :num |
2165
- Select-Object - SkipLast $using :skipLast |
2155
+ Select-Object - Index $using :num - Wait |
2166
2156
Select-Object - ExpandProperty $using :property2 |
2167
2157
Select-Object - ExpandProperty $using :property3
2168
2158
}
@@ -2173,11 +2163,11 @@ function MyGetCommand
2173
2163
}
2174
2164
2175
2165
# helper function to fill up the parameters metadata
2176
- function getParams ([int ]$num , [ int ] $totalNum ) {
2166
+ function getParams ([int ]$num ) {
2177
2167
# 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'
2179
2169
# this call we need to fill-up ParameterSets.Parameters with metadata
2180
- $parameters = expand2 ' ParameterSets' $num $totalNum ' Parameters'
2170
+ $parameters = expand2 ' ParameterSets' $num ' Parameters'
2181
2171
if ($parameters.Length -ne $parameterType.Length ) {
2182
2172
$errStr = " Metadata for $Cmdlet doesn't match length.`n " +
2183
2173
" This should never happen! Please report the issue on https://github.com/PowerShell/platyPS/issues"
0 commit comments