feat(asdf): support asdf v0.16 ahead

Co-authored-by: Valgard Trontheim <github@trontheim.de>

Closes #12964
Closes #12967
This commit is contained in:
Carlo Sala 2025-02-12 20:15:25 +01:00
parent db32c6ccce
commit 4d9d346718
No known key found for this signature in database
GPG Key ID: DA6FB450C1A4FE9A

View File

@ -1,3 +1,21 @@
if (( $+commands[asdf] )); then
export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
path=("$ASDF_DATA_DIR/shims" $path)
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `asdf`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
typeset -g -A _comps
autoload -Uz _asdf
_comps[asdf]=_asdf
fi
asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
return
fi
# TODO:(2025-02-12): remove deprecated asdf <0.16 code
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"