summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgly <[email protected]>2022-12-27 14:33:33 +0100
committergly <[email protected]>2022-12-27 14:33:33 +0100
commit71ff3a251e726fc4d16a7f5f03dc5c3b4eeb3654 (patch)
treeac71790e630641c1eba1a6ccc000dcd5783aa908
parent1e09d9c5f1d38b8536c713538e1642e5e35c972c (diff)
add comments
-rw-r--r--xmake/modules/private/xrepo/quick_search/completion.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/modules/private/xrepo/quick_search/completion.lua b/xmake/modules/private/xrepo/quick_search/completion.lua
index b8cb18891..7f6a1b3a4 100644
--- a/xmake/modules/private/xrepo/quick_search/completion.lua
+++ b/xmake/modules/private/xrepo/quick_search/completion.lua
@@ -33,14 +33,22 @@ end
function main(complete, opt)
local prefix = ""
+
+ -- check prefix if present
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
+
+ -- complete xmake packages
if prefix == "" or prefix == "xmake" then
packages = _xmake_package_complete(complete, opt)
end
+
+ -- to prevent shell completion misunderstandings,
+ -- we put back the prefix
if packages and prefix ~= "" then
for _, package in ipairs(packages) do
package.value = prefix .. "::" .. package.value