mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +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
|
# Find where asdf should be installed
|
||||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
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 [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
# 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
|
# If not found, check for Homebrew package
|
||||||
elif (( $+commands[brew] )); then
|
elif (( $+commands[brew] )); then
|
||||||
_ASDF_PREFIX="$(brew --prefix asdf)"
|
_ASDF_PREFIX="$(brew --prefix asdf)"
|
||||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
# Shell script
|
||||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
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
|
unset _ASDF_PREFIX
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
|
|
@ -19,8 +27,15 @@ if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load command
|
# Load command
|
||||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
if [[ -f "$ASDF_DIR/asdf.sh" || -f "$ASDF_DIR/bin/asdf" ]]; then
|
||||||
source "$ASDF_DIR/asdf.sh"
|
# 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
|
# Load completions
|
||||||
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||||
fpath+=("$ASDF_COMPLETIONS")
|
fpath+=("$ASDF_COMPLETIONS")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue