Skip to content

Commit 03e140c

Browse files
author
James Brundage
committed
feat: Namespace.get_Alias ( Fixes #1138 )
1 parent b626bd6 commit 03e140c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Types/Namespace/get_Alias.ps1

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<#
2+
.SYNOPSIS
3+
Gets the aliases in the namespace.
4+
.DESCRIPTION
5+
Gets all the aliases in the namespace.
6+
#>
7+
if (-not $this.Pattern) {
8+
return
9+
}
10+
if (-not $global:AllFunctionsOrFilters) {
11+
$global:AllFunctionsOrFilters = $global:ExecutionContext.SessionState.InvokeCommand.GetCommands('*','Function,Filter',$true)
12+
}
13+
foreach ($cmdPattern in $this.Pattern) {
14+
foreach ($matchingCommand in $global:AllFunctionsOrFilters -match $cmdPattern) {
15+
if ($matchingCommand.CommandType -eq 'Filter') {
16+
$matchingCommand
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)