Skip to content

Commit 4e9ebca

Browse files
committed
try fix windows shell completion
1 parent 2d95b2f commit 4e9ebca

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/django_typer/templates/shell_complete/powershell.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ $scriptblock = {
2020
$pythonPathOption = "--pythonpath=$($matches[1])"
2121
}
2222

23-
$results = {{ manage_script_name }} {{ django_command }} $settingsOption $pythonPathOption --shell {{ shell }} {{ color }} complete {{ fallback }} "$($commandText)" "$($cursorPosition)"
23+
$arguments = @("{{ django_command }}") +
24+
@($settingsOption) +
25+
@($pythonPathOption) +
26+
@("--shell", "pwsh", "complete", $commandText, $cursorPosition) |
27+
Where-Object { $_ }
28+
29+
$results = & {{ manage_script_name }} @arguments 2>&1
2430

2531
if ($results.Count -eq 0) {
2632
# avoid default path completion

tests/shellcompletion/test_powershell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class _PowerShellMixin:
2727
environment = [
2828
f"[Console]::OutputEncoding = [System.Text.Encoding]::UTF8",
2929
f"$env:DJANGO_SETTINGS_MODULE='tests.settings.completion'",
30+
f'$env:PYTHONPATH = "$PWD;$env:PYTHONPATH"',
3031
f"{Path(sys.executable).absolute().parent / 'activate.ps1'}",
3132
]
3233

0 commit comments

Comments
 (0)