< Summary - Kestrun — Combined Coverage

Information
Class: Public.Helper.Expand-KrObject
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Expand-KrObject.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 60
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 08/26/2025 - 01:25:22 Line coverage: 0% (0/14) Total lines: 59 Tag: Kestrun/Kestrun@07f821172e5dc3657f1be7e6818f18d6721cf38a09/04/2025 - 18:11:31 Line coverage: 0% (0/14) Total lines: 60 Tag: Kestrun/Kestrun@de99e24698289f3f61ac7b73e96092732ae12b05

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Expand-KrObject.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Expands an object into a formatted string for display.
 4    .DESCRIPTION
 5        This function takes an object and formats it for display in the console. It includes the type name and the objec
 6        If a label is provided, it prefixes the output with the label.
 7    .PARAMETER InputObject
 8        The object to expand and display. This can be any PowerShell object, including complex types.
 9    .PARAMETER ForegroundColor
 10        The color to use for the output text in the console. If not specified, defaults to the console's current foregro
 11    .PARAMETER Label
 12        An optional label to prefix the output. This can be used to provide context or a name for the object being displ
 13    .EXAMPLE
 14        Expand-KrObject -InputObject $myObject -ForegroundColor Cyan -Label "My Object"
 15        Displays the $myObject with a cyan foreground color and prefixes it with "My Object".
 16    .NOTES
 17        This function is designed to be used in the context of Kestrun for debugging or logging purposes.
 18#>
 19function Expand-KrObject {
 20    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '')]
 21    [KestrunRuntimeApi('Everywhere')]
 22    [CmdletBinding()]
 23    param(
 24        [Parameter(Position = 0, ValueFromPipeline = $true)]
 25        [object] $InputObject,
 26        [Parameter()]
 27        [System.ConsoleColor] $ForegroundColor,
 28        [Parameter()]
 29        [string] $Label
 30    )
 31
 32    process {
 33
 034        if ($null -eq $InputObject) {
 035            $InputObject = "`tNull Value"
 36        } else {
 037            $type = $InputObject.gettype().FullName
 038            $InputObject = $InputObject | Out-String
 039            $InputObject = "`tTypeName: $type`n$InputObject"
 40        }
 041        if ($Label) {
 042            $InputObject = "`tName: $Label $InputObject"
 43        }
 44
 045        if ($ForegroundColor) {
 046            if ($pipelineValue.Count -gt 1) {
 047                $InputObject | Write-Host -ForegroundColor $ForegroundColor
 48            } else {
 049                Write-Host -Object $InputObject -ForegroundColor $ForegroundColor
 50            }
 51        } else {
 052            if ($pipelineValue.Count -gt 1) {
 053                $InputObject | Write-Host
 54            } else {
 055                Write-Host -Object $InputObject
 56            }
 57        }
 58    }
 59}
 60

Methods/Properties

Expand-KrObject()