Skip to content

Commit fe480bb

Browse files
Merge pull request #36 from IISResetMe/development
Add -Static switch to Find-PSMDType
2 parents d95fdad + a66787b commit fe480bb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

PSModuleDevelopment/functions/assembly/Find-PSMDType.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
3030
.PARAMETER Enum
3131
Whether the type to find must be an enumeration.
32+
33+
.PARAMETER Static
34+
Whether the type to find must be static.
3235
3336
.PARAMETER Implements
3437
Whether the type to find must implement this interface
@@ -70,6 +73,9 @@
7073
[switch]
7174
$Enum,
7275

76+
[switch]
77+
$Static,
78+
7379
[string]
7480
$Implements,
7581

@@ -84,6 +90,7 @@
8490
{
8591
$boundEnum = Test-PSFParameterBinding -ParameterName Enum
8692
$boundPublic = Test-PSFParameterBinding -ParameterName Public
93+
$boundStatic = Test-PSFParameterBinding -ParameterName Static
8794
}
8895
process
8996
{
@@ -114,6 +121,7 @@
114121
if ($boundEnum -and ($Enum -ne $type.IsEnum)) { continue }
115122
if ($InheritsFrom -and ($type.BaseType.FullName -notlike $InheritsFrom)) { continue }
116123
if ($Attribute -and ($type.CustomAttributes.AttributeType.Name -notlike $Attribute)) { continue }
124+
if ($boundStatic -and ($Static -ne ($type.IsAbstract -and $type.IsSealed))) { continue }
117125

118126
$type
119127
}
@@ -123,4 +131,4 @@
123131
{
124132

125133
}
126-
}
134+
}

0 commit comments

Comments
 (0)