Skip to content

Commit b13f5ae

Browse files
author
James Brundage
committed
feat: Language.Templates.Unique/Distinct ( Fixes #940 )
Fixing Template specific naming issues.
1 parent 008e9bd commit b13f5ae

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Types/Language.Templates/get_Unique.ps1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
Gets unique templates related to a language.
66
#>
77
$distinctCommands = @{}
8-
,@(foreach ($psProperty in $this.PSObject.properties) {
8+
$ThisPSObject = $this.PSObject
9+
$theseProperties = @($this.PSObject.properties)
10+
foreach ($psProperty in $theseProperties) {
911
if ($psProperty -isnot [psnoteproperty]) { continue }
1012
if ($psProperty.Value -isnot [Management.Automation.CommandInfo]) { continue }
11-
if (
12-
$psProperty.Value -is [Management.Automation.AliasInfo] -and
13-
(
14-
$distinctCommands[$psProperty.Value.ResolvedCommand] -or
15-
$this.PSObject.Properties[$psProperty.Value.ResolvedCommand.Name]
16-
)
17-
) {
18-
continue
13+
if ($psProperty.Value -is [Management.Automation.AliasInfo]) {
14+
$aliasInfo = $psProperty.Value
15+
if (
16+
$distinctCommands[$aliasInfo.ResolvedCommand] -or
17+
$ThisPSObject.Properties[$aliasInfo.ResolvedCommand.Name -replace 'Template\p{P}']
18+
) {
19+
continue
20+
}
1921
}
2022
$distinctCommands[$psProperty.Value] = $psProperty.Value
2123
$psProperty.Value
22-
})
24+
}

0 commit comments

Comments
 (0)