4d9d346718caa6efdf6f350ed803e70d34fc6577
- Author
- Carlo Sala <carlosalag@protonmail.com>
- Committer
- Carlo Sala <carlosalag@protonmail.com>
- Date
Message
feat(asdf): support asdf v0.16 ahead
Co-authored-by: Valgard Trontheim <github@trontheim.de>
Closes #12964
Closes #12967
Diff
1diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
2index 7635d20c3c55f2609ce1bad5e0bbe95a0b4b3e00..4367e8ca3cd4401ddaedbc72ecb4b2491f1a75f2 100644
3--- a/plugins/asdf/asdf.plugin.zsh
4+++ b/plugins/asdf/asdf.plugin.zsh
5@@ -1,3 +1,21 @@
6+if (( $+commands[asdf] )); then
7+ export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
8+ path=("$ASDF_DATA_DIR/shims" $path)
9+
10+ # If the completion file doesn't exist yet, we need to autoload it and
11+ # bind it to `asdf`. Otherwise, compinit will have already done that.
12+ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
13+ typeset -g -A _comps
14+ autoload -Uz _asdf
15+ _comps[asdf]=_asdf
16+ fi
17+ asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
18+
19+ return
20+fi
21+
22+# TODO:(2025-02-12): remove deprecated asdf <0.16 code
23+
24 # Find where asdf should be installed
25 ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
26 ASDF_COMPLETIONS="$ASDF_DIR/completions"