summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2020-01-21 23:07:51 +0800
committerGitHub <[email protected]>2020-01-21 23:07:51 +0800
commit99cafe9b2ab168b89e7e1516cdb3746d9e349a04 (patch)
treee691aedf3a7b7c6a9567b539bc544c7bc37f2fae /scripts
parent3321cc86d2676241d32b9e13e59f28ca0810b4a2 (diff)
parent97b0e9c8e673325545d2e55288d66a2dd99d1cc0 (diff)
Merge pull request #673 from OpportunityLiu/dev
improve tab complete
Diffstat (limited to 'scripts')
-rwxr-xr-x[-rw-r--r--]scripts/PKGBUILD0
-rwxr-xr-xscripts/archive-all (renamed from scripts/archive-all.sh)4
-rwxr-xr-x[-rw-r--r--]scripts/get.ps10
-rwxr-xr-xscripts/get.sh60
-rwxr-xr-xscripts/makeself/build-runfile.sh2
-rw-r--r--scripts/register-completions.bash16
-rwxr-xr-x[-rw-r--r--]scripts/register-completions.ps10
-rwxr-xr-xscripts/register-completions.sh26
-rw-r--r--scripts/register-completions.zsh10
-rwxr-xr-x[-rw-r--r--]scripts/srcenv.bat0
-rwxr-xr-x[-rw-r--r--]scripts/srcenv.profile0
11 files changed, 55 insertions, 63 deletions
diff --git a/scripts/PKGBUILD b/scripts/PKGBUILD
index 5163bb1b3..5163bb1b3 100644..100755
--- a/scripts/PKGBUILD
+++ b/scripts/PKGBUILD
diff --git a/scripts/archive-all.sh b/scripts/archive-all
index 5026ae4e8..bd9be43a7 100755
--- a/scripts/archive-all.sh
+++ b/scripts/archive-all
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# ./scripts/archive-all.sh
+# ./scripts/archive-all
tmpdir=/tmp/.xmake_archive
xmakeroot=`pwd`
if [ -d $tmpdir ]; then
@@ -21,7 +21,7 @@ cd $tmpdir/repo || exit
xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake || exit
cp -r ./core $tmpdir/xmake
cp -r ./xmake $tmpdir/xmake/xmake
-cp ./scripts/get.sh $tmpdir/xmake/scripts
+cp ./scripts/*.sh $tmpdir/xmake/scripts
cp ./*.md $tmpdir/xmake
cp makefile $tmpdir/xmake
cp install $tmpdir/xmake
diff --git a/scripts/get.ps1 b/scripts/get.ps1
index 4ec3df140..4ec3df140 100644..100755
--- a/scripts/get.ps1
+++ b/scripts/get.ps1
diff --git a/scripts/get.sh b/scripts/get.sh
index fce123a23..7be3e63fd 100755
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# xmake getter
-# usage: bash <(curl -s <my location>) [[mirror:]branch] [commit/__install_only__]
+# usage: bash <(curl -s <my location>) [[mirror:]branch|__local__|__run__] [commit/__install_only__]
set -o pipefail
@@ -14,6 +14,7 @@ if [ 0 -ne "$(id -u)" ]; then
sudoprefix=
fi
else
+ export XMAKE_ROOT=y
sudoprefix=
fi
@@ -97,7 +98,7 @@ install_tools()
{ apk --version >/dev/null 2>&1 && $sudoprefix apk add gcc g++ make readline-dev ncurses-dev libc-dev linux-headers; }
}
test_tools || { install_tools && test_tools; } || my_exit "$(echo -e 'Dependencies Installation Fail\nThe getter currently only support these package managers\n\t* apt\n\t* yum\n\t* zypper\n\t* pacman\nPlease install following dependencies manually:\n\t* git\n\t* build essential like `make`, `gcc`, etc\n\t* libreadline-dev (readline-devel)\n\t* ccache (optional)')" 1
-branch=master
+branch=__run__
mirror=xmake-io
IFS=':'
if [ x != "x$1" ]; then
@@ -114,21 +115,32 @@ if [ x != "x$1" ]; then
echo "Branch: $branch"
fi
projectdir=$tmpdir
-if [ 'x__local__' != "x$branch" ]; then
+if [ 'x__local__' = "x$branch" ]; then
+ if [ -d '.git' ]; then
+ git submodule update --init --recursive
+ fi
+ cp -r . $projectdir
+ cd $projectdir || my_exit 'Chdir Error'
+elif [ 'x__run__' = "x$branch" ]; then
+ version=$(git ls-remote --tags "https://github.com/$mirror/xmake" | tail -c 7)
+ if xz --version >/dev/null 2>&1
+ then
+ pack=xz
+ else
+ pack=gz
+ fi
+ mkdir -p $projectdir
+ remote_get_content "https://github.com/$mirror/xmake/releases/download/$version/xmake-$version.$pack.run" > $projectdir/xmake.run
+ sh $projectdir/xmake.run --noexec --target $projectdir
+else
if [ x != "x$2" ]; then
git clone --depth=50 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')"
cd $projectdir || my_exit 'Chdir Error'
git checkout -qf "$2"
cd - || my_exit 'Chdir Error'
else
- git clone --depth=1 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules --shallow-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')"
+ git clone --depth=1 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')"
fi
-else
- if [ -d '.git' ]; then
- git submodule update --init --recursive
- fi
- cp -r . $projectdir
- cd $projectdir || my_exit 'Chdir Error'
fi
# do build
@@ -144,7 +156,6 @@ fi
# make bytecodes
XMAKE_PROGRAM_DIR="$projectdir/xmake" \
-XMAKE_ROOT=y \
$projectdir/core/src/demo/demo.b l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' $projectdir/xmake || my_exit 'generate bytecode failed!'
# do install
@@ -164,30 +175,11 @@ 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=""
+ if [ -f "$projectdir/scripts/register-completions.sh" ]; then
+ cat "$projectdir/scripts/register-completions.sh" >> ~/.xmake/profile
+ else
+ remote_get_content "https://github.com/$mirror/xmake/raw/master/scripts/register-completions.sh" >> ~/.xmake/profile
fi
- COMPREPLY=( $(compgen -W "$completions" -- "$word") )
- }
- complete -o default -o nospace -F _xmake_bash_complete xmake
-fi
-' >> ~/.xmake/profile
if [[ "$SHELL" = */zsh ]]; then
write_profile ~/.zshrc
diff --git a/scripts/makeself/build-runfile.sh b/scripts/makeself/build-runfile.sh
index afc7a1b3c..f46d1d1bf 100755
--- a/scripts/makeself/build-runfile.sh
+++ b/scripts/makeself/build-runfile.sh
@@ -22,7 +22,7 @@ mkdir -p $tmpdir/xmake/scripts
cd $tmpdir/repo || exit
cp -r ./xmake $tmpdir/xmake/xmake
cp -r ./core $tmpdir/xmake
-cp ./scripts/get.sh $tmpdir/xmake/scripts
+cp ./scripts/*.sh $tmpdir/xmake/scripts
cp ./*.md $tmpdir/xmake
cp makefile $tmpdir/xmake
cd $tmpdir/xmake || exit
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.ps1 b/scripts/register-completions.ps1
index a9ecd7877..a9ecd7877 100644..100755
--- a/scripts/register-completions.ps1
+++ b/scripts/register-completions.ps1
diff --git a/scripts/register-completions.sh b/scripts/register-completions.sh
new file mode 100755
index 000000000..e274605b2
--- /dev/null
+++ b/scripts/register-completions.sh
@@ -0,0 +1,26 @@
+
+# parameter completions for *nix shell
+
+if [[ "$SHELL" = */zsh ]]; then
+ # zsh parameter completion for xmake
+ _xmake_zsh_complete()
+ {
+ local completions=("$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua 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_ROOT=y xmake lua private.utils.complete "${COMP_POINT}" "nospace-nokey" "${COMP_LINE}")"
+ if [ $? -ne 0 ]; then
+ completions=""
+ fi
+ COMPREPLY=( $(compgen -W "$completions") )
+ }
+ complete -o default -o nospace -F _xmake_bash_complete xmake
+fi
+
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
diff --git a/scripts/srcenv.bat b/scripts/srcenv.bat
index 974c640b9..974c640b9 100644..100755
--- a/scripts/srcenv.bat
+++ b/scripts/srcenv.bat
diff --git a/scripts/srcenv.profile b/scripts/srcenv.profile
index 5e69b5540..5e69b5540 100644..100755
--- a/scripts/srcenv.profile
+++ b/scripts/srcenv.profile