Skip to content

Commit de109e0

Browse files
committed
prefer the full name of powershell
1 parent 4fdffa2 commit de109e0

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

docs/html/user_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ To setup for fish::
498498

499499
To setup for powershell::
500500

501-
python -m pip completion --posh | Out-File -Encoding default -Append $PROFILE
501+
python -m pip completion --powershell | Out-File -Encoding default -Append $PROFILE
502502

503503
Alternatively, you can use the result of the ``completion`` command directly
504504
with the eval function of your shell, e.g. by adding the following to your

src/pip/_internal/commands/completion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
end
4444
complete -fa "(__fish_complete_pip)" -c {prog}
4545
""",
46-
"posh": """
46+
"powershell": """
4747
if ((Test-Path Function:\\TabExpansion) -and -not `
4848
(Test-Path Function:\\_pip_completeBackup)) {{
4949
Rename-Item Function:\\TabExpansion _pip_completeBackup
@@ -99,10 +99,10 @@ def add_options(self) -> None:
9999
help="Emit completion code for fish",
100100
)
101101
self.cmd_opts.add_option(
102-
"--posh",
102+
"--powershell",
103103
"-p",
104104
action="store_const",
105-
const="posh",
105+
const="powershell",
106106
dest="shell",
107107
help="Emit completion code for powershell",
108108
)

tests/functional/test_completion.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
compctl -K _pip_completion pip""",
4545
),
4646
(
47-
"posh",
47+
"powershell",
4848
"""\
4949
if ((Test-Path Function:\\TabExpansion) -and -not `
5050
(Test-Path Function:\\_pip_completeBackup)) {
@@ -135,7 +135,8 @@ def test_completion_alone(autocomplete_script):
135135
"""
136136
result = autocomplete_script.pip("completion", allow_stderr_error=True)
137137
assert (
138-
"ERROR: You must pass --bash or --fish or --posh or --zsh" in result.stderr
138+
"ERROR: You must pass --bash or --fish or --powershell or --zsh"
139+
in result.stderr
139140
), ("completion alone failed -- " + result.stderr)
140141

141142

@@ -325,7 +326,7 @@ def test_completion_path_after_option(autocomplete, data):
325326
)
326327

327328

328-
@pytest.mark.parametrize("flag", ["--bash", "--zsh", "--fish", "--posh"])
329+
@pytest.mark.parametrize("flag", ["--bash", "--zsh", "--fish", "--powershell"])
329330
def test_completion_uses_same_executable_name(
330331
autocomplete_script, flag, deprecated_python
331332
):

0 commit comments

Comments
 (0)