Public/Find-DevVmAvailable.ps1

<#
.SYNOPSIS
Finds available versions of a runtime.
 
.DESCRIPTION
Lists available versions from the official sources for the specified runtime.
 
.PARAMETER Runtime
The runtime to check (node, java, maven, etc.)
 
.PARAMETER All
Show all available versions (may be a long list).
By default, shows only the latest versions of each major version.
 
.PARAMETER Update
Force downloading fresh data, bypassing the local cache.
By default, cached data is used if available (30-day validity).
 
.EXAMPLE
Find-DevVmAvailable -Runtime node
Find-DevVmAvailable -Runtime java -All
Find-DevVmAvailable -Runtime maven -Update
 
#>

function Find-DevVmAvailable {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [ValidateScript({ Test-DevVmRuntime $_ })]
        [string]$Runtime,

        [switch]$All,

        [switch]$Update
    )

    $runtimeInfo = Get-DevVmRuntimeInfo -Runtime $Runtime
    if (-not $runtimeInfo) {
        Write-Error "Runtime '$Runtime' not configured"
        return
    }

    if (-not $runtimeInfo.indexUrl) {
        Write-Error "Runtime '$Runtime' does not have a configured index URL"
        return
    }

    Write-Output "Fetching available $Runtime versions from $($runtimeInfo.indexUrl)..."
    Write-Output ""

    Get-DevVmAvailableVersion -Runtime $Runtime -RuntimeInfo $runtimeInfo -ShowAll $All -Update:$Update
}