|
@@ -1,12 +1,17 @@
|
|
|
-# Find where asdf should be installed.
|
|
|
+# Find where asdf should be installed
|
|
|
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
|
|
|
|
|
-# Load asdf, if found.
|
|
|
-if [ -f $ASDF_DIR/asdf.sh ]; then
|
|
|
- . $ASDF_DIR/asdf.sh
|
|
|
+# If not found, check for Homebrew package
|
|
|
+if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then
|
|
|
+ ASDF_DIR="$(brew --prefix asdf)"
|
|
|
fi
|
|
|
|
|
|
-# Load asdf completions, if found.
|
|
|
-if [ -f $ASDF_DIR/completions/asdf.bash ]; then
|
|
|
- . $ASDF_DIR/completions/asdf.bash
|
|
|
+# Load command
|
|
|
+if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
|
|
+ . "$ASDF_DIR/asdf.sh"
|
|
|
+
|
|
|
+ # Load completions
|
|
|
+ if [[ -f "$ASDF_DIR/completions/asdf.bash" ]]; then
|
|
|
+ . "$ASDF_DIR/completions/asdf.bash"
|
|
|
+ fi
|
|
|
fi
|