fix(pipenv): use argcomplete for pipenv >= 2026.5.0

pipenv >= 2026.5.0 dropped the _PIPENV_COMPLETE environment
variable and switched to argcomplete for shell completions.

Check for register-python-argcomplete command and use it when
available, falling back to the old _PIPENV_COMPLETE method
for older pipenv versions.

Fixes #13719
This commit is contained in:
御风 2026-06-14 10:53:39 +08:00
commit d01d10e50b

View file

@ -10,7 +10,12 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_pipenv" ]]; then
_comps[pipenv]=_pipenv _comps[pipenv]=_pipenv
fi fi
# pipenv >= 2026.5.0 dropped _PIPENV_COMPLETE in favor of argcomplete
if (( $+commands[register-python-argcomplete] )); then
register-python-argcomplete pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &|
else
_PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &| _PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &|
fi
if zstyle -T ':omz:plugins:pipenv' auto-shell; then if zstyle -T ':omz:plugins:pipenv' auto-shell; then
# Automatic pipenv shell activation/deactivation # Automatic pipenv shell activation/deactivation