Skip to content

Instantly share code, notes, and snippets.

@milnak
Created April 16, 2024 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milnak/29190d1532a97f66f62682a4f43d834e to your computer and use it in GitHub Desktop.
Save milnak/29190d1532a97f66f62682a4f43d834e to your computer and use it in GitHub Desktop.
scoop list + scoop info
# "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