Created
July 8, 2026 17:52
-
-
Save JeffJacobson/b9867fd4cf142b021264b632e5ec544f to your computer and use it in GitHub Desktop.
run `fnm list` and convert output to PowerShell custom objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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