| | | 1 | | <# |
| | | 2 | | .SYNOPSIS |
| | | 3 | | Gets the support status of known features in the current Kestrun runtime environment. |
| | | 4 | | .DESCRIPTION |
| | | 5 | | This cmdlet retrieves the support status of all known features defined in the Kestrun runtime. |
| | | 6 | | It provides information about whether each feature is supported based on the runtime version and configuration. |
| | | 7 | | .PARAMETER Capabilities |
| | | 8 | | If specified, only the feature name and support status will be returned, omitting the built TFM. |
| | | 9 | | .OUTPUTS |
| | | 10 | | A custom object with the following properties: |
| | | 11 | | - Feature: The name of the feature. |
| | | 12 | | - BuiltTFM: The target framework version that Kestrun was built against. |
| | | 13 | | - Supported: A boolean indicating whether the feature is supported in the current runtime environment. |
| | | 14 | | .EXAMPLE |
| | | 15 | | Get-KrFeatureSupport |
| | | 16 | | This example retrieves the support status of all known features in the current Kestrun runtime environment. |
| | | 17 | | The output will be a collection of objects, each representing a feature and its support status. |
| | | 18 | | #> |
| | | 19 | | function Get-KrFeatureSupport { |
| | | 20 | | [KestrunRuntimeApi('Everywhere')] |
| | | 21 | | [CmdletBinding(DefaultParameterSetName = 'Full')] |
| | | 22 | | [OutputType([pscustomobject])] |
| | | 23 | | param( |
| | | 24 | | [Parameter(ParameterSetName = 'Capabilities')] |
| | | 25 | | [switch] $Capabilities |
| | | 26 | | ) |
| | | 27 | | |
| | 1 | 28 | | $built = [Kestrun.KestrunRuntimeInfo]::GetBuiltTargetFrameworkVersion() |
| | 1 | 29 | | $features = [enum]::GetNames([Kestrun.KestrunRuntimeInfo+KnownFeature]) |
| | | 30 | | |
| | 1 | 31 | | foreach ($name in $features) { |
| | 1 | 32 | | $enum = [Kestrun.KestrunRuntimeInfo+KnownFeature]::$name |
| | 1 | 33 | | $supported = [Kestrun.KestrunRuntimeInfo]::Supports($enum) |
| | 1 | 34 | | if ($Capabilities) { |
| | 1 | 35 | | [pscustomobject]@{ |
| | 1 | 36 | | Feature = $name |
| | 1 | 37 | | Supported = $supported |
| | | 38 | | } |
| | | 39 | | } else { |
| | 1 | 40 | | [pscustomobject]@{ |
| | 1 | 41 | | Feature = $name |
| | 1 | 42 | | BuiltTFM = $built |
| | 1 | 43 | | Supported = $supported |
| | | 44 | | } |
| | | 45 | | } |
| | | 46 | | } |
| | | 47 | | } |