diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-07 16:57:14 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-09 02:24:51 +0800 |
| commit | c55d5f8142e48ae9f9a21cda3c82e4c4c9198fb9 (patch) | |
| tree | 22aa9525c5d57e1ff6a97fb3cf7efe3ceb1e58a8 | |
| parent | 6536ab29f7c0ca05cf734f116bef6974bab326c7 (diff) | |
fix(zsh): guard compdef call with function check
If compdef is not available, fall back to compctl
directly without invoking an undefined command.
| -rw-r--r-- | mingling_core/tmpls/comps/zsh.zsh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mingling_core/tmpls/comps/zsh.zsh b/mingling_core/tmpls/comps/zsh.zsh index f665133..7cf5f7b 100644 --- a/mingling_core/tmpls/comps/zsh.zsh +++ b/mingling_core/tmpls/comps/zsh.zsh @@ -61,8 +61,11 @@ _<<<bin_name>>>_completion() { fi } -compdef _<<<bin_name>>>_completion <<<bin_name>>> - -if [[ $? -ne 0 ]]; then +if (( $+functions[compdef] )); then + compdef _<<<bin_name>>>_completion <<<bin_name>>> + if [[ $? -ne 0 ]]; then + compctl -K _<<<bin_name>>>_completion <<<bin_name>>> + fi +else compctl -K _<<<bin_name>>>_completion <<<bin_name>>> fi |
