Skip to content

Commit 84ed813

Browse files
author
James Brundage
committed
feat: Namespace.get_Filter ( Fixes #1141 )
1 parent 031e522 commit 84ed813

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Types/Namespace/get_Filter.ps1

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

0 commit comments

Comments
 (0)