summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-03 14:20:59 +0800
committerGitHub <[email protected]>2023-03-03 14:20:59 +0800
commit0973396b09535d70d6c4c5613ea72bf5ee832137 (patch)
tree617d3c1055f0168a12f3f253c2ae7d68a89b2669
parentd469035fc49b6565a2ba7366d148d7f239bc352e (diff)
parent3d05713324f5192728cf4f3131fc7295b3ef72a5 (diff)
Merge pull request #3447 from xmake-io/profile
improve shell profile
-rw-r--r--README.md4
-rw-r--r--README_zh.md4
m---------core/src/tbox/tbox0
-rwxr-xr-xscripts/get.sh30
-rwxr-xr-xscripts/register-completions.sh48
-rw-r--r--xmake/actions/update/main.lua28
-rw-r--r--xmake/core/base/tty.lua15
-rwxr-xr-xxmake/scripts/completions/register-completions.bash45
-rwxr-xr-xxmake/scripts/completions/register-completions.fish69
-rwxr-xr-xxmake/scripts/completions/register-completions.zsh36
-rw-r--r--xmake/scripts/profile-unix.fish26
-rw-r--r--xmake/scripts/profile-unix.sh132
-rw-r--r--xmake/scripts/virtualenvs/register-virtualenvs.sh (renamed from scripts/register-virtualenvs.sh)21
13 files changed, 280 insertions, 178 deletions
diff --git a/README.md b/README.md
index 23ef89235..a31ec7484 100644
--- a/README.md
+++ b/README.md
@@ -92,13 +92,13 @@ If you want to know more, please refer to: [Documents](https://xmake.io/#/gettin
#### via curl
```bash
-bash <(curl -fsSL https://xmake.io/shget.text)
+curl -fsSL https://xmake.io/shget.text | bash
```
#### via wget
```bash
-bash <(wget https://xmake.io/shget.text -O -)
+wget https://xmake.io/shget.text -O - | bash
```
#### via powershell
diff --git a/README_zh.md b/README_zh.md
index e9c384b8c..db9a8f0a8 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -100,13 +100,13 @@ xmake 官方也推出了一些入门课程,带你一步步快速上手 xmake�
#### 使用curl
```bash
-bash <(curl -fsSL https://xmake.io/shget.text)
+curl -fsSL https://xmake.io/shget.text | bash
```
#### 使用wget
```bash
-bash <(wget https://xmake.io/shget.text -O -)
+wget https://xmake.io/shget.text -O - | bash
```
#### 使用powershell
diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox
-Subproject 5639514131a4e814738b38664ecf070ad50b76a
+Subproject 04cc154a906fd2670989bc1648c857a35a47671
diff --git a/scripts/get.sh b/scripts/get.sh
index b5c79caf8..319b8b2c7 100755
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -240,12 +240,17 @@ fi
#-----------------------------------------------------------------------------
# install profile
#
+install_profile_new() {
+ export XMAKE_ROOTDIR="$prefix/bin"
+ export PATH="$XMAKE_ROOTDIR:$PATH"
+ xmake --version
+ xmake update --integrate
+}
write_profile() {
grep -sq ".xmake/profile" $1 || echo -e "\n# >>> xmake >>>\n[[ -s \"\$HOME/.xmake/profile\" ]] && source \"\$HOME/.xmake/profile\" # load xmake profile\n# <<< xmake <<<" >> $1
}
-
-install_profile() {
+install_profile_old() {
if [ ! -d ~/.xmake ]; then mkdir ~/.xmake; fi
echo "export XMAKE_ROOTDIR=\"$prefix/bin\"" > ~/.xmake/profile
echo 'export PATH="$XMAKE_ROOTDIR:$PATH"' >> ~/.xmake/profile
@@ -272,12 +277,21 @@ install_profile() {
fi
else write_profile ~/.profile
fi
+
+ if xmake --version >/dev/null 2>&1; then xmake --version; else
+ source ~/.xmake/profile
+ xmake --version
+ echo "Reload shell profile by running the following command now!"
+ echo -e "\x1b[1msource ~/.xmake/profile\x1b[0m"
+ fi
}
-install_profile
-if xmake --version >/dev/null 2>&1; then xmake --version; else
- source ~/.xmake/profile
- xmake --version
- echo "Reload shell profile by running the following command now!"
- echo -e "\x1b[1msource ~/.xmake/profile\x1b[0m"
+if test_eq "$branch" "__local__"; then
+ install_profile_new
+elif test_eq "$branch" "dev"; then
+ install_profile_new
+elif test_eq "$branch" "master"; then
+ install_profile_new
+else
+ install_profile_old
fi
diff --git a/scripts/register-completions.sh b/scripts/register-completions.sh
deleted file mode 100755
index f3da05f10..000000000
--- a/scripts/register-completions.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-
-# 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
-
- # 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 xrepo
-
-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
-
- # 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
-
diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua
index 2413e7644..adf5f6819 100644
--- a/xmake/actions/update/main.lua
+++ b/xmake/actions/update/main.lua
@@ -291,13 +291,13 @@ end
-- initialize shells
function _initialize_shell()
- local target, command, profile
+ local target, command
if is_host("windows") then
local psshell = find_tool("pwsh") or find_tool("powershell")
local outdata, errdata = try {function () return os.iorunv(psshell.program, {"-c", "Write-Output $PROFILE.CurrentUserAllHosts"}) end}
if outdata then
target = outdata:trim()
- profile = path.join(os.programdir(), "scripts", "profile-win.ps1")
+ local profile = path.join(os.programdir(), "scripts", "profile-win.ps1")
command = format("if (Test-Path -Path \"%s\" -PathType Leaf) {\n . \"%s\"\n}", profile, profile)
else
raise("failed to get profile location from powershell!")
@@ -308,10 +308,21 @@ function _initialize_shell()
if shell:endswith("bash") then target = (is_host("macosx") and "~/.bash_profile" or "~/.bashrc")
elseif shell:endswith("zsh") then target = "~/.zshrc"
elseif shell:endswith("ksh") then target = "~/.kshrc"
+ elseif shell:endswith("fish") then target = "~/.config/fish/config.fish"
end
- profile = path.join(os.programdir(), "scripts", "profile-unix.sh")
- command = format("export XMAKE_ROOTDIR=\"%s\"\nexport PATH=\"$XMAKE_ROOTDIR:$PATH\"\n", path.directory(os.programfile()))
- command = command .. format("[[ -s \"%s\" ]] && source \"%s\"", profile, profile)
+ local profile_home = path.absolute("~/.xmake/profile")
+ command = ("test -f \"%s\" && source \"%s\""):format(profile_home, profile_home)
+
+ -- write home profile
+ local profile = "$XMAKE_PROGRAM_DIR/scripts/profile-unix.sh"
+ local profile_fish = "$XMAKE_PROGRAM_DIR/scripts/profile-unix.fish"
+ local bridge_command = format([[export XMAKE_ROOTDIR="%s"
+export XMAKE_PROGRAM_DIR="%s"
+export PATH="$XMAKE_ROOTDIR:$PATH"
+test $FISH_VERSION && test -f "%s" && source "%s" && exit 0
+test -f "%s" && source "%s"
+]], path.directory(os.programfile()), os.programdir(), profile_fish, profile_fish, profile, profile)
+ io.writefile(profile_home, bridge_command)
end
-- trace
@@ -328,7 +339,7 @@ function _initialize_shell()
file = file .. "\n"
end
end
- file = file .. "# >>> xmake >>>\n" .. command .. "\n# <<< xmake <<<"
+ file = file .. "# >>> xmake >>>\n" .. command .. "\n# <<< xmake <<<\n"
io.writefile(target, file)
return true
end,
@@ -342,6 +353,10 @@ function _initialize_shell()
-- trace
if ok then
cprint("${color.success}${text.success}")
+ if not is_host("windows") then
+ print("Reload shell profile by running the following command now!")
+ cprint("${bright}source ~/.xmake/profile${clear}")
+ end
else
cprint("${color.failure}${text.failure}")
end
@@ -516,3 +531,4 @@ function main()
_install(sourcedir)
end
end
+
diff --git a/xmake/core/base/tty.lua b/xmake/core/base/tty.lua
index 8fa00d494..26da74ecf 100644
--- a/xmake/core/base/tty.lua
+++ b/xmake/core/base/tty.lua
@@ -166,12 +166,15 @@ function tty.shell()
end
end
else
- shell = os.getenv("SHELL")
- if shell then
- for _, shellname in ipairs({"zsh", "bash", "sh"}) do
- if shell:find(shellname) then
- shell = shellname
- break
+ shell = os.getenv("XMAKE_SHELL")
+ if not shell then
+ shell = os.getenv("SHELL")
+ if shell then
+ for _, shellname in ipairs({"zsh", "bash", "sh"}) do
+ if shell:find(shellname) then
+ shell = shellname
+ break
+ end
end
end
end
diff --git a/xmake/scripts/completions/register-completions.bash b/xmake/scripts/completions/register-completions.bash
new file mode 100755
index 000000000..5569b4af8
--- /dev/null
+++ b/xmake/scripts/completions/register-completions.bash
@@ -0,0 +1,45 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage register-completions.bash
+#
+
+# 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
+
+# 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
diff --git a/xmake/scripts/completions/register-completions.fish b/xmake/scripts/completions/register-completions.fish
new file mode 100755
index 000000000..5cb73492e
--- /dev/null
+++ b/xmake/scripts/completions/register-completions.fish
@@ -0,0 +1,69 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki, Dragon1573
+# @homepage register-completions.fish
+#
+
+# fish parameter completion for xmake
+function _xmake_fish_complete
+ # Read the current command line
+ set -l raw_cmd (commandline)
+ set -l words (commandline -o)
+ # Get the current token
+ set -l token (commandline -ot)
+
+ # Call XMake built-in completion to get available results
+ set -l result (MAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.utils.complete 0 nospace "$raw_cmd")
+ if test (count $result) -lt 1
+ # When there are no available completions, the function ends immediately
+ # Otherwise, the subsequent `contains` command will trigger an error
+ return 1
+ end
+
+ # Are there multiple selectable results?
+ # When there are multiple options, the user's current token is definitely incomplete
+ test (count $result) -gt 1
+ set -l is_multiple_choice $status
+ # Is the only selectable option identical to the current token under the cursor (which may be empty)?
+ # Identical means the user has already completed the process
+ # Repeated option outputs are not completions at the current cursor position
+ contains -- $token $result
+ set -l is_token_incomplete $status
+ # Is the only selectable option identical to the last visible token of the command line array?
+ # When completing without a prefix in every token position, the current token is an empty string
+ # The last item of the command line tokenized array is the token before the cursor
+ # This is mainly used to handle completions triggered after a space without a prefix
+ contains -- $words[-1] $result
+ set -l not_token_completed $status
+
+ test \( $is_token_incomplete -eq 1 \) -a \( $not_token_completed -eq 1 \)
+ test \( $is_multiple_choice -eq 0 \) -o \( $status -eq 0 \)
+ if test $status -eq 0
+ # When the completion list has more than one item, or the current token is different from the unique token in the completion list
+ # The user must not have completed the token and needs to be provided with completion options
+ for item in $result
+ # Each result takes up a separate line, and for the "-a" parameter, it needs to be echoed separately
+ # Although the result itself has a newline, "-a" still treats it as a whole,
+ # Without tokenizing it as multiple parameters
+ if not string match -- '*error*' "$item" > /dev/null
+ echo $item
+ end
+ end
+ end
+end
+
+complete -c xmake -f -a "(_xmake_fish_complete)"
diff --git a/xmake/scripts/completions/register-completions.zsh b/xmake/scripts/completions/register-completions.zsh
new file mode 100755
index 000000000..eeaa42e7c
--- /dev/null
+++ b/xmake/scripts/completions/register-completions.zsh
@@ -0,0 +1,36 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage register-completions.zsh
+#
+
+# 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
+
+# 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 xrepo
+
diff --git a/xmake/scripts/profile-unix.fish b/xmake/scripts/profile-unix.fish
new file mode 100644
index 000000000..ea0f243de
--- /dev/null
+++ b/xmake/scripts/profile-unix.fish
@@ -0,0 +1,26 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage profile-unix.fish
+#
+
+# register environments
+export XMAKE_SHELL=fish
+
+# register completions
+. "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.fish"
+
diff --git a/xmake/scripts/profile-unix.sh b/xmake/scripts/profile-unix.sh
index cd511b04f..c3e62a734 100644
--- a/xmake/scripts/profile-unix.sh
+++ b/xmake/scripts/profile-unix.sh
@@ -1,106 +1,30 @@
-# 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
- # 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 xrepo
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage profile-unix.sh
+#
+
+# register completions
+if [[ "$SHELL" = */zsh ]]; then
+ . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.zsh"
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
- # 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
+ . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.bash"
fi
-# virtual environments for *nix shell
-function xrepo {
- if [ $# -ge 2 ] && [ "$1" = "env" ]; then
- local cmd="${2-x}"
- case "$cmd" in
- shell)
- if test "${XMAKE_PROMPT_BACKUP}"; then
- PS1="${XMAKE_PROMPT_BACKUP}"
- source "${XMAKE_ENV_BACKUP}" || return 1
- unset XMAKE_PROMPT_BACKUP
- unset XMAKE_ENV_BACKUP
- fi
- xmake lua private.xrepo.action.env.info config || return 1
- local prompt="$(xmake lua --quiet private.xrepo.action.env.info prompt)" || return 1
- if [ -z "${prompt+x}" ]; then
- return 1
- fi
- local activateCommand="$(xmake lua private.xrepo.action.env.info script.bash)" || return 1
- export XMAKE_ENV_BACKUP="$(xmake lua private.xrepo.action.env.info envfile)"
- export XMAKE_PROMPT_BACKUP="${PS1}"
- xmake lua private.xrepo.action.env.info backup.bash 1>"$XMAKE_ENV_BACKUP"
- eval "$activateCommand"
- PS1="${prompt} $PS1"
- ;;
- quit)
- if test "${XMAKE_PROMPT_BACKUP}"; then
- PS1="${XMAKE_PROMPT_BACKUP}"
- source "${XMAKE_ENV_BACKUP}" || return 1
- unset XMAKE_PROMPT_BACKUP
- unset XMAKE_ENV_BACKUP
- fi
- ;;
- -b|--bind)
- if [ "$4" = "shell" ]; then
- local bnd="${3-x}"
- if test "${XMAKE_PROMPT_BACKUP}"; then
- PS1="${XMAKE_PROMPT_BACKUP}"
- source "${XMAKE_ENV_BACKUP}" || return 1
- unset XMAKE_PROMPT_BACKUP
- unset XMAKE_ENV_BACKUP
- fi
- xmake lua private.xrepo.action.env.info config $bnd || return 1
- local prompt="$(xmake lua --quiet private.xrepo.action.env.info prompt $bnd)" || return 1
- if [ -z "${prompt+x}" ]; then
- return 1
- fi
- local activateCommand="$(xmake lua --quiet private.xrepo.action.env.info script.bash $bnd)" || return 1
- export XMAKE_ENV_BACKUP="$(xmake lua private.xrepo.action.env.info envfile $bnd)"
- export XMAKE_PROMPT_BACKUP="${PS1}"
- xmake lua --quiet private.xrepo.action.env.info backup.bash $bnd 1>"$XMAKE_ENV_BACKUP"
- eval "$activateCommand"
- PS1="${prompt} $PS1"
- else
- xmake lua private.xrepo "$@"
- fi
- ;;
- *)
- xmake lua private.xrepo "$@"
- ;;
- esac
- else
- xmake lua private.xrepo "$@"
- fi
-} \ No newline at end of file
+
+# register virtualenvs
+. "$XMAKE_PROGRAM_DIR/scripts/virtualenvs/register-virtualenvs.sh"
+
diff --git a/scripts/register-virtualenvs.sh b/xmake/scripts/virtualenvs/register-virtualenvs.sh
index 6b0c25160..e853a54ba 100644
--- a/scripts/register-virtualenvs.sh
+++ b/xmake/scripts/virtualenvs/register-virtualenvs.sh
@@ -1,5 +1,22 @@
-
-# virtual environments for *nix shell
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki, xq114
+# @homepage register-virtualenvs.sh
+#
if test "${XMAKE_ROOTDIR}"; then
export XMAKE_EXE=${XMAKE_ROOTDIR}/xmake