Skip to content

Commit 604a084

Browse files
StartAutomatingStartAutomating
StartAutomating
authored and
StartAutomating
committed
feat: Language.Templates/Function.ByInputType ( Fixes #843 )
1 parent 19d8ec3 commit 604a084

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

PipeScript.types.ps1xml

+68
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,40 @@ return $false
21412141
})
21422142
</GetScriptBlock>
21432143
</ScriptProperty>
2144+
<ScriptProperty>
2145+
<Name>ByInputType</Name>
2146+
<GetScriptBlock>
2147+
&lt;#
2148+
.SYNOPSIS
2149+
Gets Language Functions by Input Type
2150+
.DESCRIPTION
2151+
Returns a dictionary of all unique language functions that accept a pipeline parameter.
2152+
2153+
The key will be the type of parameter accepted.
2154+
The value will be a list of commands that accept that parameter from the pipeline.
2155+
.NOTES
2156+
Primitive parameter types and string types will be ignored.
2157+
#&gt;
2158+
param()
2159+
# We want the results to be ordered (both the keys and the values)
2160+
$byInputType = [Ordered]@{}
2161+
$uniqueList = @($this.Unique | Sort-Object Order)
2162+
foreach ($uniqueCommand in $uniqueList) {
2163+
, @(foreach ($parameterSet in $uniqueCommand.ParameterSets) {
2164+
foreach ($parameterInSet in $parameterSet.Parameters) {
2165+
if (-not $parameterInSet.ValueFromPipeline) { continue }
2166+
if ($parameterInSet.ParameterType.IsPrimitive) { continue }
2167+
if ($parameterInSet.ParameterType -eq [string]) { continue }
2168+
if (-not $byInputType[$parameterInSet.ParameterType]) {
2169+
$byInputType[$parameterInSet.ParameterType] = [Collections.Generic.List[PSObject]]::new()
2170+
}
2171+
$byInputType[$parameterInSet.ParameterType].Add($uniqueCommand)
2172+
}
2173+
})
2174+
}
2175+
$byInputType
2176+
</GetScriptBlock>
2177+
</ScriptProperty>
21442178
<ScriptProperty>
21452179
<Name>Count</Name>
21462180
<GetScriptBlock>
@@ -2209,6 +2243,40 @@ $distinctCommands = @{}
22092243
})
22102244
</GetScriptBlock>
22112245
</ScriptProperty>
2246+
<ScriptProperty>
2247+
<Name>ByInputType</Name>
2248+
<GetScriptBlock>
2249+
&lt;#
2250+
.SYNOPSIS
2251+
Gets Language Templates by Input Type
2252+
.DESCRIPTION
2253+
Returns a dictionary of all unique language templates that accept a pipeline parameter.
2254+
2255+
The key will be the type of parameter accepted.
2256+
The value will be a list of commands that accept that parameter from the pipeline.
2257+
.NOTES
2258+
Primitive parameter types and string types will be ignored.
2259+
#&gt;
2260+
param()
2261+
# We want the results to be ordered (both the keys and the values)
2262+
$byInputType = [Ordered]@{}
2263+
$uniqueList = @($this.Unique | Sort-Object Order)
2264+
foreach ($uniqueCommand in $uniqueList) {
2265+
, @(foreach ($parameterSet in $uniqueCommand.ParameterSets) {
2266+
foreach ($parameterInSet in $parameterSet.Parameters) {
2267+
if (-not $parameterInSet.ValueFromPipeline) { continue }
2268+
if ($parameterInSet.ParameterType.IsPrimitive) { continue }
2269+
if ($parameterInSet.ParameterType -eq [string]) { continue }
2270+
if (-not $byInputType[$parameterInSet.ParameterType]) {
2271+
$byInputType[$parameterInSet.ParameterType] = [Collections.Generic.List[PSObject]]::new()
2272+
}
2273+
$byInputType[$parameterInSet.ParameterType].Add($uniqueCommand)
2274+
}
2275+
})
2276+
}
2277+
$byInputType
2278+
</GetScriptBlock>
2279+
</ScriptProperty>
22122280
<ScriptProperty>
22132281
<Name>Count</Name>
22142282
<GetScriptBlock>

0 commit comments

Comments
 (0)