mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix!: do not remove items from PATH in POSIX entrypoint (#1521)
This commit is contained in:
parent
6a6c539f4a
commit
b6d0ca28d5
24
asdf.sh
24
asdf.sh
@ -47,7 +47,7 @@ if [ -z "$ASDF_DIR" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$ASDF_DIR" ]; then
|
if [ -z "$ASDF_DIR" ]; then
|
||||||
printf "%s\n" "asdf: Error: Source directory could not be calculated. Please set it manually before sourcing this file." >&2
|
printf "%s\n" "asdf: Error: Source directory could not be calculated. Please set \$ASDF_DIR manually before sourcing this file." >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -56,22 +56,20 @@ if [ ! -d "$ASDF_DIR" ]; then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_asdf_bin="${ASDF_DIR}/bin"
|
_asdf_bin="$ASDF_DIR/bin"
|
||||||
_asdf_shims="${ASDF_DATA_DIR:-$HOME/.asdf}/shims"
|
_asdf_shims="${ASDF_DATA_DIR:-$HOME/.asdf}/shims"
|
||||||
|
|
||||||
# shellcheck disable=SC3060
|
case ":$PATH:" in
|
||||||
if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
|
*":$_asdf_bin:"*) : ;;
|
||||||
case ":$PATH:" in
|
*) PATH="$_asdf_bin:$PATH" ;;
|
||||||
*":${_asdf_bin}:"*) PATH="${PATH//$_asdf_bin:/}" ;;
|
esac
|
||||||
esac
|
case ":$PATH:" in
|
||||||
case ":$PATH:" in
|
*":$_asdf_shims:"*) : ;;
|
||||||
*":${_asdf_shims}:"*) PATH="${PATH//$_asdf_shims:/}" ;;
|
*) PATH="$_asdf_shims:$PATH" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
|
|
||||||
PATH="${_asdf_bin}:${_asdf_shims}:$PATH"
|
|
||||||
unset -v _asdf_bin _asdf_shims
|
unset -v _asdf_bin _asdf_shims
|
||||||
|
|
||||||
# shellcheck source=lib/asdf.sh
|
# shellcheck source=lib/asdf.sh
|
||||||
. "${ASDF_DIR}/lib/asdf.sh"
|
. "$ASDF_DIR/lib/asdf.sh"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user