Last active
December 24, 2023 15:36
-
-
Save mgoodness/aa4026fa154ee859e661a0d8f0999361 to your computer and use it in GitHub Desktop.
"New" (compsys) zsh completion script for pyenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef pyenv | |
# Ref: https://github.com/pyenv/pyenv/pull/1644 | |
if [[ ! -o interactive ]]; then | |
return | |
fi | |
local state line | |
typeset -A opt_args | |
_arguments -C \ | |
{--help,-h}'[Show help]' \ | |
{--version,-v}'[Show pyenv version]' \ | |
'(-): :->command' \ | |
'*:: :->option-or-argument' | |
case "$state" in | |
(command) | |
local -a commands | |
commands=(${(f)"$(pyenv commands)"}) | |
_describe -t commands 'command' commands | |
;; | |
(option-or-argument) | |
local -a args | |
args=(${(f)"$(pyenv completions ${line[1]})"}) | |
_describe -t args 'arg' args | |
;; | |
esac | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment