< Summary - Kestrun — Combined Coverage

Information
Class: Public.Helper.Get-KrVersion
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Get-KrVersion.ps1
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
0%
Covered lines: 0
Uncovered lines: 17
Coverable lines: 17
Total lines: 56
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 12/18/2025 - 21:41:58 Line coverage: 0% (0/17) Total lines: 56 Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Get-KrVersion.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Retrieves the Kestrun module version information.
 4.DESCRIPTION
 5    This function returns the version information of the Kestrun PowerShell module.
 6    It can return either a formatted version string or a detailed object containing version components.
 7.PARAMETER AsString
 8    If specified, the function returns the version as a formatted string (e.g., "1.2.3-preview").
 9    If not specified, the function returns a custom object with detailed version information.
 10.EXAMPLE
 11    Get-KrVersion -AsString
 12    Returns the Kestrun module version as a formatted string.
 13.EXAMPLE
 14    Get-KrVersion
 15    Returns a custom object with detailed version information.
 16.NOTES
 17    This function is useful for retrieving version information for logging, diagnostics, or display purposes.
 18#>
 19function Get-KrVersion {
 20    [KestrunRuntimeApi('Everywhere')]
 21    [CmdletBinding()]
 22    [OutputType([string])]
 23    [OutputType([psobject])]
 24    param(
 25        [Parameter()]
 26        [switch] $AsString
 27    )
 28
 029    $module = Get-Module -Name Kestrun -ErrorAction SilentlyContinue
 30
 031    if (-not $module) {
 032        Write-Verbose 'Kestrun module is not loaded.'
 033        return $null
 34    }
 35
 036    $version = $module.Version
 037    $prerelease = $module.PrivateData?.PSData?.Prerelease
 38
 039    $full = if ($prerelease) {
 040        "$version-$prerelease"
 41    } else {
 042        "$version"
 43    }
 44
 045    if ($AsString) {
 046        return $full
 47    }
 48
 049    [pscustomobject]@{
 050        Name = $module.Name
 051        Version = $version
 052        Prerelease = $prerelease
 053        FullVersion = $full
 054        Path = $module.Path
 55    }
 56}

Methods/Properties

Get-KrVersion()