mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
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.
16 lines
549 B
Bash
16 lines
549 B
Bash
# 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)
|
|
|
|
# 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" &|
|