mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Update asdf plugin for asdf version >= 0.16
This commit is contained in:
parent
db32c6ccce
commit
8273b5239f
1 changed files with 19 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# Find where asdf should be installed
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
|
||||
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||
|
|
@ -10,8 +11,15 @@ if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
|||
# If not found, check for Homebrew package
|
||||
elif (( $+commands[brew] )); then
|
||||
_ASDF_PREFIX="$(brew --prefix asdf)"
|
||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||
# Shell script
|
||||
if [[ -d "${_ASDF_PREFIX}/libexec" ]]; then
|
||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||
# Binary (go)
|
||||
else
|
||||
ASDF_DIR="${_ASDF_PREFIX}"
|
||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||
fi
|
||||
unset _ASDF_PREFIX
|
||||
else
|
||||
return
|
||||
|
|
@ -19,8 +27,15 @@ if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
|||
fi
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
source "$ASDF_DIR/asdf.sh"
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" || -f "$ASDF_DIR/bin/asdf" ]]; then
|
||||
# Shell script: load script
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
source "$ASDF_DIR/asdf.sh"
|
||||
fi
|
||||
# Binary (go): add shims to path
|
||||
if [[ -f "$ASDF_DIR/bin/asdf" ]]; then
|
||||
path=("$ASDF_DATA_DIR/shims" $path)
|
||||
fi
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
fpath+=("$ASDF_COMPLETIONS")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue