Skip to content

Commit 4fccc13

Browse files
StartAutomatingStartAutomating
StartAutomating
authored and
StartAutomating
committed
feat: Language.Templates.Unique/Distinct ( Fixes #940 )
Fixing Template specific naming issues.
1 parent 904426e commit 4fccc13

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

PipeScript.types.ps1xml

+12-10
Original file line numberDiff line numberDiff line change
@@ -2235,21 +2235,23 @@ $distinctCommands = @{}
22352235
Gets unique templates related to a language.
22362236
#>
22372237
$distinctCommands = @{}
2238-
,@(foreach ($psProperty in $this.PSObject.properties) {
2238+
$ThisPSObject = $this.PSObject
2239+
$theseProperties = @($this.PSObject.properties)
2240+
foreach ($psProperty in $theseProperties) {
22392241
if ($psProperty -isnot [psnoteproperty]) { continue }
22402242
if ($psProperty.Value -isnot [Management.Automation.CommandInfo]) { continue }
2241-
if (
2242-
$psProperty.Value -is [Management.Automation.AliasInfo] -and
2243-
(
2244-
$distinctCommands[$psProperty.Value.ResolvedCommand] -or
2245-
$this.PSObject.Properties[$psProperty.Value.ResolvedCommand.Name]
2246-
)
2247-
) {
2248-
continue
2243+
if ($psProperty.Value -is [Management.Automation.AliasInfo]) {
2244+
$aliasInfo = $psProperty.Value
2245+
if (
2246+
$distinctCommands[$aliasInfo.ResolvedCommand] -or
2247+
$ThisPSObject.Properties[$aliasInfo.ResolvedCommand.Name -replace 'Template\p{P}']
2248+
) {
2249+
continue
2250+
}
22492251
}
22502252
$distinctCommands[$psProperty.Value] = $psProperty.Value
22512253
$psProperty.Value
2252-
})
2254+
}
22532255
</GetScriptBlock>
22542256
</ScriptProperty>
22552257
</Members>

0 commit comments

Comments
 (0)