fix(asdf): allow plugin to initialize if asdf is installed in ~/.asdf

Previously, the plugin exited early if the `asdf` command was not already
in $PATH:

  (( ! $+commands[asdf] )) && return

This broke valid setups where `asdf` is installed manually in ~/.asdf
and not yet sourced globally (e.g., via .zshrc). Such installs are still
recommended in the official asdf documentation.

This change replaces the early exit with a check for the presence of
~/.asdf, so the plugin only runs if the user has a modern asdf setup,
while avoiding premature return before `$PATH` and completions are set up.

This preserves the new plugin behavior (removal of legacy <0.16 logic),
while restoring compatibility for the common manual install path.
This commit is contained in:
Muhammed Oguz 2025-04-11 12:09:47 +03:00
commit 4bc1d27ef5

View file

@ -1,4 +1,7 @@
(( ! $+commands[asdf] )) && return
# Only continue if .asdf directory exists (manual install) or fallback logic can apply
if [[ ! -d "$HOME/.asdf" ]]; then
return
fi
export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
path=("$ASDF_DATA_DIR/shims" $path)