diff options
| author | Gly <[email protected]> | 2022-12-27 00:32:21 +0100 |
|---|---|---|
| committer | Gly <[email protected]> | 2022-12-27 00:32:21 +0100 |
| commit | 12eb32a0901d297e17d0363f3f64334ea039ffe3 (patch) | |
| tree | 049e1e2fbfd74c4e0e3ab72ce7853b5e92452c01 | |
| parent | bda18437013c9075d54dafedc7723065512876b2 (diff) | |
Package manager awareness
| -rw-r--r-- | xmake/modules/private/xrepo/quick_search/complete.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/xmake/modules/private/xrepo/quick_search/complete.lua b/xmake/modules/private/xrepo/quick_search/complete.lua index 1b3c58c85..e6d117b88 100644 --- a/xmake/modules/private/xrepo/quick_search/complete.lua +++ b/xmake/modules/private/xrepo/quick_search/complete.lua @@ -20,7 +20,7 @@ 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 @@ -29,4 +29,22 @@ function main(complete, opt) end 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 |
