Skip to content

Commit 46416dc

Browse files
author
James Brundage
committed
feat: Namespace.get_Variable ( Fixes #1144 )
1 parent b4bb2aa commit 46416dc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Types/Namespace/get_Variable.ps1

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<#
2+
.SYNOPSIS
3+
Gets the variables in the namespace.
4+
.DESCRIPTION
5+
Gets all the variables in the namespace.
6+
7+
These are all the variables where the name matches the pattern of the namespace,
8+
or the `.Value.pstypenames` match the pattern of the namespace.
9+
#>
10+
11+
foreach ($variable in Get-ChildItem variable:) {
12+
if ($variable.Name -in 'this','_') { return }
13+
if ($variable.Name -match $this.Pattern) {
14+
$variable
15+
}
16+
elseif ($variable.value.pstypenames -match $this.Pattern) {
17+
$variable
18+
}
19+
}

0 commit comments

Comments
 (0)