a78d006faa022a5104b542d7dec5a3439e72046e

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

fix(asdf)!: remove legacy <0.16 integration

`asdf` plugin only supports asdf 0.16 and ahead from now on.

Diff

 1diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
 2index 4367e8ca3cd4401ddaedbc72ecb4b2491f1a75f2..318267dcbbb95279296efe0dc49a80488ae6969d 100644
 3--- a/plugins/asdf/asdf.plugin.zsh
 4+++ b/plugins/asdf/asdf.plugin.zsh
 5@@ -1,48 +1,13 @@
 6-if (( $+commands[asdf] )); then
 7-  export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
 8-  path=("$ASDF_DATA_DIR/shims" $path)
 9+(( ! $+commands[asdf] )) && return
10 
11-  # If the completion file doesn't exist yet, we need to autoload it and
12-  # bind it to `asdf`. Otherwise, compinit will have already done that.
13-  if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
14-    typeset -g -A _comps
15-    autoload -Uz _asdf
16-    _comps[asdf]=_asdf
17-  fi
18-  asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
19+export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
20+path=("$ASDF_DATA_DIR/shims" $path)
21 
22-  return
23-fi
24-
25-# TODO:(2025-02-12): remove deprecated asdf <0.16 code
26-
27-# Find where asdf should be installed
28-ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
29-ASDF_COMPLETIONS="$ASDF_DIR/completions"
30-
31-if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
32-  # If not found, check for archlinux/AUR package (/opt/asdf-vm/)
33-  if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
34-    ASDF_DIR="/opt/asdf-vm"
35-    ASDF_COMPLETIONS="$ASDF_DIR"
36-  # If not found, check for Homebrew package
37-  elif (( $+commands[brew] )); then
38-    _ASDF_PREFIX="$(brew --prefix asdf)"
39-    ASDF_DIR="${_ASDF_PREFIX}/libexec"
40-    ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
41-    unset _ASDF_PREFIX
42-  else
43-    return
44-  fi
45-fi
46-
47-# Load command
48-if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
49-  source "$ASDF_DIR/asdf.sh"
50-  # Load completions
51-  if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
52-    fpath+=("$ASDF_COMPLETIONS")
53-    autoload -Uz _asdf
54-    compdef _asdf asdf # compdef is already loaded before loading plugins
55-  fi
56+# If the completion file doesn't exist yet, we need to autoload it and
57+# bind it to `asdf`. Otherwise, compinit will have already done that.
58+if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
59+  typeset -g -A _comps
60+  autoload -Uz _asdf
61+  _comps[asdf]=_asdf
62 fi
63+asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|