Package manager awareness
import("private.xrepo.quick_search.cache")
-function main(complete, opt)
+function xmake_package_complete(complete, opt)
local packages = cache.get()
local candidates = {}
for _, package in ipairs(packages) do
@@ -30,3 +30,21 @@ function main(complete, opt)
end
return candidates
end
+
+function main(complete, opt)
+ local prefix = ""
+ if complete:find("::", 1, true) then
+ prefix = complete:sub(1, complete:find("::", 1, true) - 1)
+ complete = complete:sub(complete:find("::", 1, true) + 2)
+ end
+ local packages
+ if prefix == "" or prefix == "xmake" then
+ packages = xmake_package_complete(complete, opt)
+ end
+ if packages and prefix ~= "" then
+ for _, package in ipairs(packages) do
+ package.value = prefix .. "::" .. package.value
+ end
+ end
+ return packages or {}
+end
\ No newline at end of file
