Skip to content

Commit

Permalink
feat(completions): 更新 scoop
Browse files Browse the repository at this point in the history
  • Loading branch information
abgox committed Jan 9, 2025
1 parent bdb7199 commit 56f0e96
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion completions/scoop/guid.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3bb4d7f8-340f-4e99-a24c-d45c9c19b3cf
94080990-8c8d-4ac4-8d6b-c1e083a757a9
30 changes: 30 additions & 0 deletions completions/scoop/hooks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,36 @@ function handleCompletions($completions) {
}
}
}
'install' {
$dir = @()
Get-ChildItem "$root_path\buckets" -Directory | ForEach-Object {
$dir += @{
bucket = $_.BaseName
path = "$($_.FullName)\bucket"
}
}
$return = $PSCompletions.handle_data_by_runspace($dir, {
param ($items, $PSCompletions, $Host_UI)
$return = @()
foreach ($item in $items) {
Get-ChildItem $item.path -File -Depth 1 | ForEach-Object {
$app = "$($item.bucket)/$($_.BaseName)"
if ($app -notin $PSCompletions.input_arr) {
$return += @{
ListItemText = $app
CompletionText = $app
symbols = @("SpaceTab")
}
}
}
}
return $return
}, {
param($results)
return $results
})
$tempList += $return
}
'uninstall' {
if ($filter_input_arr.Count -gt 1) {
$selected = $filter_input_arr[1..($filter_input_arr.Count - 1)]
Expand Down

0 comments on commit 56f0e96

Please sign in to comment.