summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/private/xrepo/action/install.lua3
-rw-r--r--xmake/modules/private/xrepo/quick_search/complete.lua11
2 files changed, 13 insertions, 1 deletions
diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua
index f650e5ff1..abef10ada 100644
--- a/xmake/modules/private/xrepo/action/install.lua
+++ b/xmake/modules/private/xrepo/action/install.lua
@@ -79,7 +79,8 @@ function menu_options()
" - xrepo install -p iphoneos -a arm64 \"zlib >=1.2.0\"",
" - xrepo install -p android [--ndk=/xxx] -m debug \"pcre2 10.x\"",
" - xrepo install -p mingw [--mingw=/xxx] -k shared zlib",
- " - xrepo install conan::zlib/1.2.11 vcpkg::zlib"}
+ " - xrepo install conan::zlib/1.2.11 vcpkg::zlib",
+ values = function (complete, opt) return import("private.xrepo.quick_search.complete")(complete, opt) end}
}
-- show menu options
diff --git a/xmake/modules/private/xrepo/quick_search/complete.lua b/xmake/modules/private/xrepo/quick_search/complete.lua
new file mode 100644
index 000000000..48de72e56
--- /dev/null
+++ b/xmake/modules/private/xrepo/quick_search/complete.lua
@@ -0,0 +1,11 @@
+import("private.xrepo.quick_search.cache")
+function main(complete, opt)
+ local packages = cache.get()
+ local candidates = {}
+ for _, package in ipairs(packages) do
+ if package.name:startswith(complete) then
+ table.insert(candidates, package.name)
+ end
+ end
+ return candidates
+end \ No newline at end of file