Skip to content

Commit

Permalink
Merge pull request #397 from tomato3713/add-scoop-subcmd-completion
Browse files Browse the repository at this point in the history
Add scoop subcommand completion
  • Loading branch information
hymkor authored Jan 18, 2021
2 parents 37123f2 + 64cea4d commit 288975b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions nyagos.d/catalog/subcomplete.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,26 @@ local function update_cache()
"mod", "run", "test", "tool", "version", "vet"
}

-- scoop
share.maincmds["scoop"] = load_subcommands_cache("scoop-subcommands.txt")
if not share.maincmds["scoop"] then
local fd=io.popen("scoop help", "r")
if fd then
local list = {}
for line in fd:lines() do
local m=string.match(line,"^(%w+)%s+%w+")
if m then
list[#list+1] = m
end
end
fd:close()
if #list >= 1 then
share.maincmds["scoop"] = list
save_subcommands_cache("scoop-subcommands.txt", list)
end
end
end

for cmd,subcmdData in pairs(share.maincmds or {}) do
if not nyagos.complete_for[cmd] then
nyagos.complete_for[cmd] = function(args)
Expand Down

0 comments on commit 288975b

Please sign in to comment.