| | | 1 | | <# |
| | | 2 | | .SYNOPSIS |
| | | 3 | | Check if a specific feature is supported in the current Kestrun runtime environment. |
| | | 4 | | .DESCRIPTION |
| | | 5 | | This cmdlet checks if a given feature, identified by its name, is supported in the current Kestrun runtime environme |
| | | 6 | | It can be used to determine if certain capabilities are available based on the runtime version and configuration. |
| | | 7 | | .PARAMETER Feature |
| | | 8 | | The name of the feature to check. This can be either the name of a KnownFeature enum value or a raw string represent |
| | | 9 | | .EXAMPLE |
| | | 10 | | Test-KrCapability -Feature "Http3" |
| | | 11 | | This example checks if the Http3 feature is supported in the current Kestrun runtime environment. |
| | | 12 | | .EXAMPLE |
| | | 13 | | Test-KrCapability -Feature "SomeOtherFeature" |
| | | 14 | | This example checks if a feature named "SomeOtherFeature" is supported, using a raw string. |
| | | 15 | | #> |
| | | 16 | | function Test-KrCapability { |
| | | 17 | | [KestrunRuntimeApi('Everywhere')] |
| | | 18 | | [CmdletBinding()] |
| | | 19 | | [OutputType([bool])] |
| | | 20 | | param( |
| | | 21 | | [Parameter(Mandatory)] |
| | | 22 | | [string]$Feature |
| | | 23 | | ) |
| | | 24 | | # Allow either enum name or raw string |
| | | 25 | | try { |
| | 0 | 26 | | $enum = [Kestrun.KestrunRuntimeInfo+KnownFeature]::$Feature |
| | 0 | 27 | | return [Kestrun.KestrunRuntimeInfo]::Supports($enum) |
| | | 28 | | } catch [System.ArgumentException] { |
| | 0 | 29 | | return [Kestrun.KestrunRuntimeInfo]::Supports($Feature) |
| | | 30 | | } |
| | | 31 | | } |