Created
April 16, 2024 15:54
-
-
Save milnak/29190d1532a97f66f62682a4f43d834e to your computer and use it in GitHub Desktop.
scoop list + scoop info
This file contains 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
# "scoop info" is slow, so do it in parallel. | |
$ScriptBlock = { | |
Param([string]$app) | |
$info = scoop.ps1 info $app | |
[PSCustomObject]@{ | |
'App' = $app | |
'Version' = $info.Version | |
'Description' = $info.Description | |
'Website' = $info.Website | |
} | |
} | |
$MaxThreads = 10 | |
$list = scoop list | Select-Object Source,Name,Version | |
foreach ($entry in $list) { | |
while ($(Get-Job -State Running).Count -ge $MaxThreads) { | |
Start-Sleep -Milliseconds 100 | |
} | |
Start-Job -ScriptBlock $ScriptBlock -ArgumentList ('{0}/{1}' -f $entry.Source, $entry.Name) | Out-Null | |
} | |
# Wait for all jobs to complete and retrieve their output | |
Get-Job | Wait-Job | Receive-Job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment