summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2020-01-21 18:04:36 +0800
committerOpportunityLiu <[email protected]>2020-01-21 18:04:36 +0800
commit91e30c6b31122d74ce147467ccbf685255a69f6b (patch)
tree6fb56fcab3e5c965836b50ba67afaa7e8a369ae7 /scripts
parent3d8f3777203b84435f85c073a46fcaa8ed02d053 (diff)
try fix complete
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get.sh25
-rw-r--r--scripts/register-completions.bash16
-rw-r--r--scripts/register-completions.sh25
-rw-r--r--scripts/register-completions.zsh10
4 files changed, 26 insertions, 50 deletions
diff --git a/scripts/get.sh b/scripts/get.sh
index fa8cc3005..607a4cbc2 100755
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -175,30 +175,7 @@ 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_SKIP_HISTORY=1 xmake lua --root private.utils.complete 0 nospace "$words")")
- reply=( "${(ps:\n:)completions}" )
- }
- compctl -f -S "" -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_SKIP_HISTORY=1 xmake lua --root private.utils.complete "${COMP_POINT}" "conf" "${COMP_LINE}" 2>/dev/null)"
- if [ $? -ne 0 ]; then
- completions=""
- fi
- COMPREPLY=( $(compgen -W "$completions" -- "$word") )
- }
- complete -o default -o nospace -F _xmake_bash_complete xmake
-fi
-' >> ~/.xmake/profile
+ remote_get_content "https://github.com/$mirror/xmake/raw/master/scripts/register-completions.sh" >> ~/.xmake/profile
if [[ "$SHELL" = */zsh ]]; then
write_profile ~/.zshrc
diff --git a/scripts/register-completions.bash b/scripts/register-completions.bash
deleted file mode 100644
index 18df8a3b7..000000000
--- a/scripts/register-completions.bash
+++ /dev/null
@@ -1,16 +0,0 @@
-# bash parameter completion for xmake
-
-_xmake_bash_complete()
-{
- local word=${COMP_WORDS[COMP_CWORD]}
-
- local completions
- completions="$(XMAKE_SKIP_HISTORY=1 xmake lua --root private.utils.complete "${COMP_POINT}" "conf" "${COMP_LINE}" 2>/dev/null)"
- if [ $? -ne 0 ]; then
- completions=""
- fi
-
- COMPREPLY=( $(compgen -W "$completions" -- "$word") )
-}
-
-complete -o default -o nospace -F _xmake_bash_complete xmake
diff --git a/scripts/register-completions.sh b/scripts/register-completions.sh
new file mode 100644
index 000000000..e95e4558f
--- /dev/null
+++ b/scripts/register-completions.sh
@@ -0,0 +1,25 @@
+
+# parameter completions for *nix shell
+
+if [[ "$SHELL" = */zsh ]]; then
+ # zsh parameter completion for xmake
+ _xmake_zsh_complete()
+ {
+ local completions=("$(XMAKE_SKIP_HISTORY=1 xmake lua --root private.utils.complete 0 nospace "$words")")
+ reply=( "${(ps:\n:)completions}" )
+ }
+ compctl -f -S "" -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_SKIP_HISTORY=1 xmake lua --root private.utils.complete "${COMP_POINT}" "conf" "${COMP_LINE}" 2>/dev/null)"
+ if [ $? -ne 0 ]; then
+ completions=""
+ fi
+ COMPREPLY=( $(compgen -W "$completions" -- "$word") )
+ }
+ complete -o default -o nospace -F _xmake_bash_complete xmake
+fi \ No newline at end of file
diff --git a/scripts/register-completions.zsh b/scripts/register-completions.zsh
deleted file mode 100644
index 5c16cf334..000000000
--- a/scripts/register-completions.zsh
+++ /dev/null
@@ -1,10 +0,0 @@
-# zsh parameter completion for xmake
-
-_xmake_zsh_complete()
-{
- local completions=("$(XMAKE_SKIP_HISTORY=1 xmake lua --root private.utils.complete 0 nospace "$words")")
-
- reply=( "${(ps:\n:)completions}" )
-}
-
-compctl -f -S "" -K _xmake_zsh_complete xmake