Public/Show-DevVmPath.ps1

<#
.SYNOPSIS
Displays the persistent PATH status for DevVm runtimes.
 
.DESCRIPTION
Shows which runtimes are currently in the user's persistent PATH environment variable.
This displays only the PATH entries managed by DevVm, not the entire system PATH.
 
.EXAMPLE
Show-DevVmPath
 
.EXAMPLE
devvm path show
 
#>

function Show-DevVmPath {
    [CmdletBinding()]
    param()

    Write-Output ""
    Write-Output "DevVm Persistent PATH Status"
    Write-Output "============================="
    Write-Output ""

    $hasEntries = $false

    foreach ($runtime in $script:DevVmConfig.RuntimeDefinitions.runtimes.PSObject.Properties.Name) {
        $basePath = Get-DevVmInstallPath -Runtime $runtime
        $inPath = Test-DevVmPersistentPath -BasePath $basePath
        $pathEntry = Get-DevVmPersistentPathEntry -BasePath $basePath

        if ($inPath) {
            $hasEntries = $true
            Write-Output "[*] $runtime"
            Write-Output " Path: $pathEntry"
            Write-Output " Scope: User"
            Write-Output ""
        }
    }

    if (-not $hasEntries) {
        Write-Output "No DevVm runtimes found in persistent PATH."
        Write-Output ""
        Write-Output "To add a runtime to persistent PATH:"
        Write-Output ' devvm use <runtime> <version> -Persist path'
        Write-Output ""
    }
    else {
        Write-Output "To remove a runtime from persistent PATH:"
        Write-Output ' devvm path clear <runtime>'
        Write-Output ""
    }
}