From b14cb76831863973a09ce7d1bc00e9aba0beec7b Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 3 Mar 2023 00:54:18 +0800 Subject: improve get.sh --- scripts/get.sh | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) (limited to 'scripts') diff --git a/scripts/get.sh b/scripts/get.sh index b5c79caf8..1350e3470 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -240,40 +240,9 @@ fi #----------------------------------------------------------------------------- # install profile # - -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() { - if [ ! -d ~/.xmake ]; then mkdir ~/.xmake; fi - echo "export XMAKE_ROOTDIR=\"$prefix/bin\"" > ~/.xmake/profile - echo 'export PATH="$XMAKE_ROOTDIR:$PATH"' >> ~/.xmake/profile - if [ -f "$projectdir/scripts/register-completions.sh" ]; then - cat "$projectdir/scripts/register-completions.sh" >> ~/.xmake/profile - else - remote_get_content "$gitrepo_raw/scripts/register-completions.sh" >> ~/.xmake/profile - fi - - if [ -f "$projectdir/scripts/register-virtualenvs.sh" ]; then - cat "$projectdir/scripts/register-virtualenvs.sh" >> ~/.xmake/profile - else - remote_get_content "$gitrepo_raw/scripts/register-virtualenvs.sh" >> ~/.xmake/profile - fi - - if [[ "$SHELL" = */zsh ]]; then - write_profile ~/.zshrc - elif [[ "$SHELL" = */ksh ]]; then - write_profile ~/.kshrc - elif [[ "$SHELL" = */bash ]]; then - write_profile ~/.bashrc - if [ "$(uname)" == "Darwin" ]; then - write_profile ~/.bash_profile - fi - else write_profile ~/.profile - fi -} -install_profile +export XMAKE_ROOTDIR="$prefix/bin" +export PATH="$XMAKE_ROOTDIR:$PATH" +xmake update --integrate if xmake --version >/dev/null 2>&1; then xmake --version; else source ~/.xmake/profile xmake --version -- cgit v1.3.1 From 0d79efba9a282712c4dc1f8b2e63999a2d1b9236 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 3 Mar 2023 00:56:07 +0800 Subject: improve profile-unix.sh --- scripts/register-completions.sh | 48 --------------- scripts/register-virtualenvs.sh | 72 ----------------------- xmake/actions/update/main.lua | 4 +- xmake/scripts/profile-unix.sh | 108 +--------------------------------- xmake/scripts/register-completions.sh | 48 +++++++++++++++ xmake/scripts/register-virtualenvs.sh | 72 +++++++++++++++++++++++ 6 files changed, 124 insertions(+), 228 deletions(-) delete mode 100755 scripts/register-completions.sh delete mode 100644 scripts/register-virtualenvs.sh create mode 100755 xmake/scripts/register-completions.sh create mode 100644 xmake/scripts/register-virtualenvs.sh (limited to 'scripts') 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/scripts/register-virtualenvs.sh b/scripts/register-virtualenvs.sh deleted file mode 100644 index 6b0c25160..000000000 --- a/scripts/register-virtualenvs.sh +++ /dev/null @@ -1,72 +0,0 @@ - -# virtual environments for *nix shell - -if test "${XMAKE_ROOTDIR}"; then - export XMAKE_EXE=${XMAKE_ROOTDIR}/xmake -else - export XMAKE_EXE=xmake -fi - -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_EXE" lua private.xrepo.action.env.info config || return 1 - local prompt="$("$XMAKE_EXE" lua --quiet private.xrepo.action.env.info prompt)" || return 1 - if [ -z "${prompt+x}" ]; then - return 1 - fi - local activateCommand="$("$XMAKE_EXE" lua private.xrepo.action.env.info script.bash)" || return 1 - export XMAKE_ENV_BACKUP="$("$XMAKE_EXE" lua private.xrepo.action.env.info envfile)" - export XMAKE_PROMPT_BACKUP="${PS1}" - "$XMAKE_EXE" 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_EXE" lua private.xrepo.action.env.info config $bnd || return 1 - local prompt="$("$XMAKE_EXE" lua --quiet private.xrepo.action.env.info prompt $bnd)" || return 1 - if [ -z "${prompt+x}" ]; then - return 1 - fi - local activateCommand="$("$XMAKE_EXE" lua --quiet private.xrepo.action.env.info script.bash $bnd)" || return 1 - export XMAKE_ENV_BACKUP="$("$XMAKE_EXE" lua private.xrepo.action.env.info envfile $bnd)" - export XMAKE_PROMPT_BACKUP="${PS1}" - "$XMAKE_EXE" lua --quiet private.xrepo.action.env.info backup.bash $bnd 1>"$XMAKE_ENV_BACKUP" - eval "$activateCommand" - PS1="${prompt} $PS1" - else - "$XMAKE_EXE" lua private.xrepo "$@" - fi - ;; - *) - "$XMAKE_EXE" lua private.xrepo "$@" - ;; - esac - else - "$XMAKE_EXE" lua private.xrepo "$@" - fi -} diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua index b7561365d..2c0f0b600 100644 --- a/xmake/actions/update/main.lua +++ b/xmake/actions/update/main.lua @@ -312,8 +312,8 @@ function _initialize_shell() command = "[[ -s \"$HOME/.xmake/profile\" ]] && source \"$HOME/.xmake/profile\"" -- write home profile - local profile = path.join(os.programdir(), "scripts", "profile-unix.sh") - local bridge_command = format("export XMAKE_ROOTDIR=\"%s\"\nexport PATH=\"$XMAKE_ROOTDIR:$PATH\"\n", path.directory(os.programfile())) + local profile = "$XMAKE_PROGRAM_DIR/scripts/profile-unix.sh" + local bridge_command = format("export XMAKE_ROOTDIR=\"%s\"\nexport XMAKE_PROGRAM_DIR=\"%s\"\nexport PATH=\"$XMAKE_ROOTDIR:$PATH\"\n", path.directory(os.programfile()), os.programdir()) bridge_command = bridge_command .. format("[[ -s \"%s\" ]] && source \"%s\"\n", profile, profile) io.writefile("~/.xmake/profile", bridge_command) end diff --git a/xmake/scripts/profile-unix.sh b/xmake/scripts/profile-unix.sh index cd511b04f..4036fa2ca 100644 --- a/xmake/scripts/profile-unix.sh +++ b/xmake/scripts/profile-unix.sh @@ -1,106 +1,2 @@ -# 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 -# 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 +. "$XMAKE_PROGRAM_DIR/scripts/register-completions.sh" +. "$XMAKE_PROGRAM_DIR/scripts/register-virtualenvs.sh" diff --git a/xmake/scripts/register-completions.sh b/xmake/scripts/register-completions.sh new file mode 100755 index 000000000..f3da05f10 --- /dev/null +++ b/xmake/scripts/register-completions.sh @@ -0,0 +1,48 @@ + +# 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/scripts/register-virtualenvs.sh b/xmake/scripts/register-virtualenvs.sh new file mode 100644 index 000000000..6b0c25160 --- /dev/null +++ b/xmake/scripts/register-virtualenvs.sh @@ -0,0 +1,72 @@ + +# virtual environments for *nix shell + +if test "${XMAKE_ROOTDIR}"; then + export XMAKE_EXE=${XMAKE_ROOTDIR}/xmake +else + export XMAKE_EXE=xmake +fi + +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_EXE" lua private.xrepo.action.env.info config || return 1 + local prompt="$("$XMAKE_EXE" lua --quiet private.xrepo.action.env.info prompt)" || return 1 + if [ -z "${prompt+x}" ]; then + return 1 + fi + local activateCommand="$("$XMAKE_EXE" lua private.xrepo.action.env.info script.bash)" || return 1 + export XMAKE_ENV_BACKUP="$("$XMAKE_EXE" lua private.xrepo.action.env.info envfile)" + export XMAKE_PROMPT_BACKUP="${PS1}" + "$XMAKE_EXE" 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_EXE" lua private.xrepo.action.env.info config $bnd || return 1 + local prompt="$("$XMAKE_EXE" lua --quiet private.xrepo.action.env.info prompt $bnd)" || return 1 + if [ -z "${prompt+x}" ]; then + return 1 + fi + local activateCommand="$("$XMAKE_EXE" lua --quiet private.xrepo.action.env.info script.bash $bnd)" || return 1 + export XMAKE_ENV_BACKUP="$("$XMAKE_EXE" lua private.xrepo.action.env.info envfile $bnd)" + export XMAKE_PROMPT_BACKUP="${PS1}" + "$XMAKE_EXE" lua --quiet private.xrepo.action.env.info backup.bash $bnd 1>"$XMAKE_ENV_BACKUP" + eval "$activateCommand" + PS1="${prompt} $PS1" + else + "$XMAKE_EXE" lua private.xrepo "$@" + fi + ;; + *) + "$XMAKE_EXE" lua private.xrepo "$@" + ;; + esac + else + "$XMAKE_EXE" lua private.xrepo "$@" + fi +} -- cgit v1.3.1 From f3f1a248578819b5876630c62996078bc36b4744 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 3 Mar 2023 22:56:05 +0800 Subject: improve tips --- scripts/get.sh | 2 -- xmake/actions/update/main.lua | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/get.sh b/scripts/get.sh index 1350e3470..d12c67686 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -246,7 +246,5 @@ xmake update --integrate 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 diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua index 4433d18d8..dc8b3bcf0 100644 --- a/xmake/actions/update/main.lua +++ b/xmake/actions/update/main.lua @@ -352,6 +352,10 @@ test -f "%s" && source "%s" -- 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 -- cgit v1.3.1 From 35a4cff31c0090e75b04ad1ef41a1c517b3c45ae Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 3 Mar 2023 22:56:59 +0800 Subject: improve get.sh --- scripts/get.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/get.sh b/scripts/get.sh index d12c67686..21c97db87 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -242,9 +242,6 @@ fi # export XMAKE_ROOTDIR="$prefix/bin" export PATH="$XMAKE_ROOTDIR:$PATH" +xmake --version xmake update --integrate -if xmake --version >/dev/null 2>&1; then xmake --version; else - source ~/.xmake/profile - xmake --version -fi -- cgit v1.3.1 From e142ac03925e8f04a8d58084ba00ca1edd0379e9 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 3 Mar 2023 23:05:02 +0800 Subject: improve get.sh --- scripts/get.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/get.sh b/scripts/get.sh index 21c97db87..319b8b2c7 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -240,8 +240,58 @@ fi #----------------------------------------------------------------------------- # install profile # -export XMAKE_ROOTDIR="$prefix/bin" -export PATH="$XMAKE_ROOTDIR:$PATH" -xmake --version -xmake update --integrate +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_old() { + if [ ! -d ~/.xmake ]; then mkdir ~/.xmake; fi + echo "export XMAKE_ROOTDIR=\"$prefix/bin\"" > ~/.xmake/profile + echo 'export PATH="$XMAKE_ROOTDIR:$PATH"' >> ~/.xmake/profile + if [ -f "$projectdir/scripts/register-completions.sh" ]; then + cat "$projectdir/scripts/register-completions.sh" >> ~/.xmake/profile + else + remote_get_content "$gitrepo_raw/scripts/register-completions.sh" >> ~/.xmake/profile + fi + + if [ -f "$projectdir/scripts/register-virtualenvs.sh" ]; then + cat "$projectdir/scripts/register-virtualenvs.sh" >> ~/.xmake/profile + else + remote_get_content "$gitrepo_raw/scripts/register-virtualenvs.sh" >> ~/.xmake/profile + fi + + if [[ "$SHELL" = */zsh ]]; then + write_profile ~/.zshrc + elif [[ "$SHELL" = */ksh ]]; then + write_profile ~/.kshrc + elif [[ "$SHELL" = */bash ]]; then + write_profile ~/.bashrc + if [ "$(uname)" == "Darwin" ]; then + write_profile ~/.bash_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 +} +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 -- cgit v1.3.1