mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-12 11:25:34 -05:00
Merge pull request #1434 from rbenv/init-path
Use absolute path in `rbenv init` instructions if needed
This commit is contained in:
commit
98412dba80
1 changed files with 18 additions and 9 deletions
|
@ -45,6 +45,11 @@ root="${BASH_SOURCE:-$0}"
|
||||||
root="${root%/*}"
|
root="${root%/*}"
|
||||||
root="${root%/*}"
|
root="${root%/*}"
|
||||||
|
|
||||||
|
rbenv_in_path=true
|
||||||
|
if [ -n "$RBENV_ORIG_PATH" ]; then
|
||||||
|
PATH="$RBENV_ORIG_PATH" command -v rbenv >/dev/null || rbenv_in_path=""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$print" ]; then
|
if [ -z "$print" ]; then
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
bash )
|
bash )
|
||||||
|
@ -68,18 +73,27 @@ if [ -z "$print" ]; then
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
{ echo "# Load rbenv automatically by appending"
|
rbenv_command=rbenv
|
||||||
echo "# the following to ${profile}:"
|
if [ -z "$rbenv_in_path" ]; then
|
||||||
|
rbenv_command="$root/bin/rbenv"
|
||||||
|
rbenv_command="${rbenv_command/$HOME\//~/}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ echo "# Please add the following line to your \`${profile}' file,"
|
||||||
|
echo "# then restart your terminal."
|
||||||
echo
|
echo
|
||||||
|
[ -t 2 ] && printf '\e[33;1m'
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
echo 'status --is-interactive; and rbenv init - fish | source'
|
printf 'status --is-interactive; and %s init - fish | source' "$rbenv_command"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
printf 'eval "$(rbenv init - %s)"\n' "$shell"
|
printf 'eval "$(%s init - %s)"' "$rbenv_command" "$shell"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
[ -t 2 ] && printf '\e[m'
|
||||||
|
echo
|
||||||
echo
|
echo
|
||||||
} >&2
|
} >&2
|
||||||
|
|
||||||
|
@ -88,11 +102,6 @@ fi
|
||||||
|
|
||||||
mkdir -p "${RBENV_ROOT}/"{shims,versions}
|
mkdir -p "${RBENV_ROOT}/"{shims,versions}
|
||||||
|
|
||||||
rbenv_in_path=true
|
|
||||||
if [ -n "$RBENV_ORIG_PATH" ]; then
|
|
||||||
PATH="$RBENV_ORIG_PATH" command -v rbenv >/dev/null || rbenv_in_path=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
[ -n "$rbenv_in_path" ] || printf "set -gx PATH '%s/bin' \$PATH\n" "$root"
|
[ -n "$rbenv_in_path" ] || printf "set -gx PATH '%s/bin' \$PATH\n" "$root"
|
||||||
|
|
Loading…
Reference in a new issue