@@ -13,29 +13,30 @@ foreach ($transpilerCmd in Get-Transpiler) {
1313}
1414
1515$MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
16- $aliasNames +=
17- @ (
18- if ($MyModule -isnot [Management.Automation.PSModuleInfo ]) {
19- Write-Error " '$MyModule ' must be a [Management.Automation.PSModuleInfo]"
20- } elseif ($MyModule.ExportedCommands.Count ) {
21- foreach ($cmd in $MyModule.ExportedCommands.Values ) {
22- if ($cmd.CommandType -in ' Alias' ) {
23- $cmd
24- }
25- }
26- } else {
27- foreach ($cmd in $ExecutionContext.SessionState.InvokeCommand.GetCommands (' *' , ' Function,Cmdlet' , $true )) {
28- if ($cmd.Module -ne $MyModule ) { continue }
29- if (' Alias' -contains ' Alias' -and $cmd.ScriptBlock.Attributes.AliasNames ) {
30- foreach ($aliasName in $cmd.ScriptBlock.Attributes.AliasNames ) {
31- $ExecutionContext.SessionState.InvokeCommand.GetCommand ($aliasName , ' Alias' )
32- }
33- }
34- if (' Alias' -contains $cmd.CommandType ) {
35- $cmd
36- }
37- }
38- })
39-
16+ $aliasNames +=
17+
18+ @ (
19+ if ($MyModule -isnot [Management.Automation.PSModuleInfo ]) {
20+ Write-Error " '$MyModule ' must be a [Management.Automation.PSModuleInfo]"
21+ } elseif ($MyModule.ExportedCommands.Count ) {
22+ foreach ($cmd in $MyModule.ExportedCommands.Values ) {
23+ if ($cmd.CommandType -in ' Alias' ) {
24+ $cmd
25+ }
26+ }
27+ } else {
28+ foreach ($cmd in $ExecutionContext.SessionState.InvokeCommand.GetCommands (' *' , ' Function,Cmdlet' , $true )) {
29+ if ($cmd.Module -ne $MyModule ) { continue }
30+ if (' Alias' -contains ' Alias' -and $cmd.ScriptBlock.Attributes.AliasNames ) {
31+ foreach ($aliasName in $cmd.ScriptBlock.Attributes.AliasNames ) {
32+ $ExecutionContext.SessionState.InvokeCommand.GetCommand ($aliasName , ' Alias' )
33+ }
34+ }
35+ if (' Alias' -contains $cmd.CommandType ) {
36+ $cmd
37+ }
38+ }
39+ })
40+
4041
4142Export-ModuleMember - Function * - Alias $aliasNames
0 commit comments