2018-08-07 16:10:35 +00:00
|
|
|
# Find where asdf should be installed
|
2016-03-30 06:05:07 +00:00
|
|
|
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
2019-02-08 14:14:09 +00:00
|
|
|
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
2016-03-30 06:05:07 +00:00
|
|
|
|
2021-05-06 17:02:37 +00:00
|
|
|
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
|
|
|
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
|
|
|
ASDF_DIR="/opt/asdf-vm"
|
|
|
|
ASDF_COMPLETIONS="$ASDF_DIR"
|
|
|
|
fi
|
|
|
|
|
2018-08-07 16:10:35 +00:00
|
|
|
# If not found, check for Homebrew package
|
2020-05-23 17:02:56 +00:00
|
|
|
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
|
2021-12-05 07:48:00 +00:00
|
|
|
brew_prefix="$(brew --prefix asdf)"
|
|
|
|
ASDF_DIR="${brew_prefix}/libexec"
|
|
|
|
ASDF_COMPLETIONS="${brew_prefix}/etc/bash_completion.d"
|
|
|
|
unset brew_prefix
|
2016-03-30 06:05:07 +00:00
|
|
|
fi
|
2018-04-22 18:27:12 +00:00
|
|
|
|
2018-08-07 16:10:35 +00:00
|
|
|
# Load command
|
|
|
|
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
2021-12-05 07:48:00 +00:00
|
|
|
. "$ASDF_DIR/asdf.sh"
|
2018-08-07 16:10:35 +00:00
|
|
|
|
2021-12-05 07:48:00 +00:00
|
|
|
# Load completions
|
|
|
|
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
|
|
|
. "$ASDF_COMPLETIONS/asdf.bash"
|
|
|
|
fi
|
2018-04-22 18:27:12 +00:00
|
|
|
fi
|