mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #11417 from Freed-Wu/fix-zsh
This commit is contained in:
commit
324dd44495
3 changed files with 11 additions and 19 deletions
1
news/11416.bugfix.rst
Normal file
1
news/11416.bugfix.rst
Normal file
|
@ -0,0 +1 @@
|
|||
Fix ``pip completion --zsh``.
|
|
@ -22,15 +22,10 @@ COMPLETION_SCRIPTS = {
|
|||
complete -o default -F _pip_completion {prog}
|
||||
""",
|
||||
"zsh": """
|
||||
function _pip_completion {{
|
||||
local words cword
|
||||
read -Ac words
|
||||
read -cn cword
|
||||
reply=( $( COMP_WORDS="$words[*]" \\
|
||||
COMP_CWORD=$(( cword-1 )) \\
|
||||
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ))
|
||||
}}
|
||||
compctl -K _pip_completion {prog}
|
||||
#compdef -P pip[0-9.]#
|
||||
compadd $( COMP_WORDS="$words[*]" \\
|
||||
COMP_CWORD=$((CURRENT-1)) \\
|
||||
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )
|
||||
""",
|
||||
"fish": """
|
||||
function __fish_complete_pip
|
||||
|
|
|
@ -44,15 +44,10 @@ complete -fa "(__fish_complete_pip)" -c pip""",
|
|||
(
|
||||
"zsh",
|
||||
"""\
|
||||
function _pip_completion {
|
||||
local words cword
|
||||
read -Ac words
|
||||
read -cn cword
|
||||
reply=( $( COMP_WORDS="$words[*]" \\
|
||||
COMP_CWORD=$(( cword-1 )) \\
|
||||
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ))
|
||||
}
|
||||
compctl -K _pip_completion pip""",
|
||||
#compdef -P pip[0-9.]#
|
||||
compadd $( COMP_WORDS="$words[*]" \\
|
||||
COMP_CWORD=$((CURRENT-1)) \\
|
||||
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )""",
|
||||
),
|
||||
(
|
||||
"powershell",
|
||||
|
@ -392,7 +387,8 @@ def test_completion_path_after_option(
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("flag", ["--bash", "--zsh", "--fish", "--powershell"])
|
||||
# zsh completion script doesn't contain pip3
|
||||
@pytest.mark.parametrize("flag", ["--bash", "--fish", "--powershell"])
|
||||
def test_completion_uses_same_executable_name(
|
||||
autocomplete_script: PipTestEnvironment, flag: str, deprecated_python: bool
|
||||
) -> None:
|
||||
|
|
Loading…
Reference in a new issue