From 9a150a71c2803accd17f63f9df307aed6fad867e Mon Sep 17 00:00:00 2001 From: Matheus Felipe Date: Mon, 18 May 2026 15:29:14 -0300 Subject: [PATCH] fix(pipenv): add argcomplete compatibility for >= 2026.5.0 and keep legacy completion --- plugins/pipenv/pipenv.plugin.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh index 2836212da..0279b1286 100644 --- a/plugins/pipenv/pipenv.plugin.zsh +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -9,15 +9,19 @@ fi # pipenv >= 2026.5.0 removed this mechanism and switched to argcomplete-based # completion using register-python-argcomplete instead. -if (( $+commands[register-python-argcomplete] )); then - # pipenv >= 2026.5.0 (argcomplete-based completion) - autoload -U bashcompinit +autoload -Uz is-at-least + +_pipenv_version="${$(pipenv --version 2>/dev/null)#pipenv, version }" + +if is-at-least 2026.5.0 "$_pipenv_version" && (( $+commands[register-python-argcomplete] )); then + # argcomplete-based completion + autoload -Uz bashcompinit bashcompinit eval "$(register-python-argcomplete pipenv)" else - # pipenv < 2026.5.0 (legacy Click-based completion via _PIPENV_COMPLETE) + # legacy Click-based completion via _PIPENV_COMPLETE # If the completion file doesn't exist yet, we need to autoload it and # bind it to `pipenv`. Otherwise, compinit will have already done that.