1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Fix zsh completion script (#12173)

This commit is contained in:
Pradyun Gedam 2023-10-07 14:29:52 +01:00 committed by GitHub
commit 9b7348269b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 6 deletions

1
news/12166.bugfix.rst Normal file
View file

@ -0,0 +1 @@
Fix completion script for zsh

View file

@ -23,9 +23,18 @@ COMPLETION_SCRIPTS = {
""", """,
"zsh": """ "zsh": """
#compdef -P pip[0-9.]# #compdef -P pip[0-9.]#
__pip() {{
compadd $( COMP_WORDS="$words[*]" \\ compadd $( COMP_WORDS="$words[*]" \\
COMP_CWORD=$((CURRENT-1)) \\ COMP_CWORD=$((CURRENT-1)) \\
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ) PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )
}}
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
# autoload from fpath, call function directly
__pip "$@"
else
# eval/source/. command, register function for later
compdef __pip -P 'pip[0-9.]#'
fi
""", """,
"fish": """ "fish": """
function __fish_complete_pip function __fish_complete_pip

View file

@ -44,9 +44,18 @@ complete -fa "(__fish_complete_pip)" -c pip""",
"zsh", "zsh",
"""\ """\
#compdef -P pip[0-9.]# #compdef -P pip[0-9.]#
__pip() {
compadd $( COMP_WORDS="$words[*]" \\ compadd $( COMP_WORDS="$words[*]" \\
COMP_CWORD=$((CURRENT-1)) \\ COMP_CWORD=$((CURRENT-1)) \\
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )""", PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )
}
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
# autoload from fpath, call function directly
__pip "$@"
else
# eval/source/. command, register function for later
compdef __pip -P 'pip[0-9.]#'
fi""",
), ),
( (
"powershell", "powershell",