asdf.plugin.zsh 524 Bytes
Newer Older
1
# Find where asdf should be installed
Rob Loach's avatar
Rob Loach committed
2
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
3
ASDF_COMPLETIONS="$ASDF_DIR/completions"
Rob Loach's avatar
Rob Loach committed
4

5
# If not found, check for Homebrew package
6
if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
7
   ASDF_DIR="$(brew --prefix asdf)"
8
   ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
Rob Loach's avatar
Rob Loach committed
9
fi
10

11
12
13
14
15
# Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
    . "$ASDF_DIR/asdf.sh"

    # Load completions
16
17
    if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
        . "$ASDF_COMPLETIONS/asdf.bash"
18
    fi
19
fi