diff options
Diffstat (limited to 'scripts/get.sh')
| -rwxr-xr-x | scripts/get.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/get.sh b/scripts/get.sh index 98a59ec2a..164ec9c48 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -147,6 +147,42 @@ install_profile() { if [ ! -d ~/.xmake ]; then mkdir ~/.xmake; fi echo "export PATH=$prefix/bin:\$PATH" > ~/.xmake/profile + echo ' +if [[ "$SHELL" = */zsh ]]; then + + # zsh parameter completion for xmake + + _xmake_zsh_complete() + { + local completions=("$(xmake lua private.utils.complete 0 "$words")") + + reply=( "${(ps:\n:)completions}" ) + } + + compctl -K _xmake_zsh_complete xmake + +elif [[ "$SHELL" = */bash ]]; then + +# bash parameter completion for xmake + + _xmake_bash_complete() + { + local word=${COMP_WORDS[COMP_CWORD]} + + local completions + completions="$(xmake lua private.utils.complete "${COMP_POINT}" "${COMP_LINE}" 2>/dev/null)" + if [ $? -ne 0 ]; then + completions="" + fi + + COMPREPLY=( $(compgen -W "$completions" -- "$word") ) + } + + complete -f -F _xmake_bash_complete xmake + +fi +' >> ~/.xmake/profile + if [[ "$SHELL" = */zsh ]]; then write_profile ~/.zshrc elif [[ "$SHELL" = */ksh ]]; then write_profile ~/.kshrc elif [[ "$SHELL" = */bash ]]; then write_profile ~/.bashrc |
