summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-25 23:19:43 +0800
committerruki <[email protected]>2026-03-25 23:19:43 +0800
commite3f123981d80c54af1b29b87a4a173557a51d73d (patch)
tree4ccb7f6a1640e2936289a8f8dc85c43b93c2c0fa
parent78e0d4e9e9752f440b645f86db9d3c8eb14e44ca (diff)
fix complete again
-rw-r--r--xmake/scripts/completions/register-completions.zsh31
1 files changed, 8 insertions, 23 deletions
diff --git a/xmake/scripts/completions/register-completions.zsh b/xmake/scripts/completions/register-completions.zsh
index 1c4c09fa1..e4010efe7 100644
--- a/xmake/scripts/completions/register-completions.zsh
+++ b/xmake/scripts/completions/register-completions.zsh
@@ -1,3 +1,5 @@
+#compdef xmake xrepo
+#
# A cross-platform build utility based on Lua
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,36 +20,19 @@
# @homepage register-completions.zsh
#
-# zsh parameter completion for xmake (using compsys)
+# zsh parameter completion for xmake
_xmake_zsh_complete() {
local completions=("${(@f)$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.utils.complete 0 nospace "$words")}")
compadd -Q -S '' -- ${completions[@]}
}
-# zsh parameter completion for xrepo (using compsys)
+# zsh parameter completion for xrepo
_xrepo_zsh_complete() {
local completions=("${(@f)$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.xrepo.complete 0 nospace "$words")}")
compadd -Q -S '' -- ${completions[@]}
}
-# register completions using compdef (modern zsh completion system)
-if (( $+functions[compdef] )); then
- compdef _xmake_zsh_complete xmake
- compdef _xrepo_zsh_complete xrepo
-else
- # fallback to compctl for older zsh without compsys
- _xmake_zsh_complete_legacy() {
- local words
- read -Ac words
- local completions=("$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.utils.complete 0 nospace "$words")")
- reply=( "${(ps:\n:)completions}" )
- }
- _xrepo_zsh_complete_legacy() {
- local words
- read -Ac words
- local completions=("$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.xrepo.complete 0 nospace "$words")")
- reply=( "${(ps:\n:)completions}" )
- }
- compctl -f -S "" -K _xmake_zsh_complete_legacy xmake
- compctl -f -S "" -K _xrepo_zsh_complete_legacy xrepo
-fi
+case "$service" in
+ xmake) _xmake_zsh_complete ;;
+ xrepo) _xrepo_zsh_complete ;;
+esac