diff options
| author | ruki <[email protected]> | 2022-12-29 00:19:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-12-29 00:19:32 +0800 |
| commit | 462982dc86241441060a9e802806899f78fd3f74 (patch) | |
| tree | 4c1724d22f941e0904109f228e7982beaea7b8b7 /scripts | |
| parent | c6af394c4aa2fac804db111610e49e8adb13ad8c (diff) | |
install xrepo complete in scripts
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/register-completions.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/register-completions.sh b/scripts/register-completions.sh index e274605b2..40a8edac3 100755 --- a/scripts/register-completions.sh +++ b/scripts/register-completions.sh @@ -9,6 +9,15 @@ if [[ "$SHELL" = */zsh ]]; then reply=( "${(ps:\n:)completions}" ) } compctl -f -S "" -K _xmake_zsh_complete xmake + + # zsh parameter completion for xrepo + _xrepo_zsh_complete() + { + 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 _xrepo_zsh_complete xmake + elif [[ "$SHELL" = */bash ]]; then # bash parameter completion for xmake _xmake_bash_complete() @@ -22,5 +31,18 @@ elif [[ "$SHELL" = */bash ]]; then COMPREPLY=( $(compgen -W "$completions") ) } complete -o default -o nospace -F _xmake_bash_complete xmake + + # bash parameter completion for xrepo + _xrepo_bash_complete() + { + local word=${COMP_WORDS[COMP_CWORD]} + local completions + completions="$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.xrepo.complete "${COMP_POINT}" "nospace-nokey" "${COMP_LINE}")" + if [ $? -ne 0 ]; then + completions="" + fi + COMPREPLY=( $(compgen -W "$completions") ) + } + complete -o default -o nospace -F _xrepo_bash_complete xrepo fi |
