Skip to content

Instantly share code, notes, and snippets.

@JeffJacobson
Created July 8, 2026 17:52
Show Gist options
  • Select an option

  • Save JeffJacobson/b9867fd4cf142b021264b632e5ec544f to your computer and use it in GitHub Desktop.

Select an option

Save JeffJacobson/b9867fd4cf142b021264b632e5ec544f to your computer and use it in GitHub Desktop.
run `fnm list` and convert output to PowerShell custom objects
fnm list | Select-String -Pattern '(?in)^\* (?<version>[\S+]+)(?<label>(\s[^,\s]+)(,\s*\S+)?)?' |
Select-Object -ExpandProperty Matches |
ForEach-Object {
$h = @{}
foreach ($g in $_.Groups) {
if (-not $g.Success -or $g.Name -eq '0') {
continue;
}
$h.Add($g.Name, $g.Value)
}
[pscustomobject]$h
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment