Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Zsh completion install #69

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_completion/test_completion_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_completion_install_zsh():
)
new_text = completion_path.read_text()
completion_path.write_text(text)
install_script = 'eval "$(_TUTORIAL001.PY_COMPLETE=source_szh tutorial001.py)"'
install_script = 'eval "$(_TUTORIAL001.PY_COMPLETE=source_zsh tutorial001.py)"'
assert install_script not in text
assert install_script in new_text
assert "completion installed in" in result.stdout
Expand Down Expand Up @@ -124,7 +124,7 @@ def test_completion_install_powershell():
subprocess,
"run",
return_value=subprocess.CompletedProcess(
["pwsh"], returncode=0, stdout=completion_path_bytes,
["pwsh"], returncode=0, stdout=completion_path_bytes
),
):
result = runner.invoke(app, ["--install-completion"])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_completion/test_completion_install_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_completion_install_source_zsh():
},
)
assert (
'eval "$(_TUTORIAL001.PY_COMPLETE=source_szh tutorial001.py)"' in result.stdout
'eval "$(_TUTORIAL001.PY_COMPLETE=source_zsh tutorial001.py)"' in result.stdout
)


Expand Down
2 changes: 1 addition & 1 deletion typer/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def get_installable_script(prog_name: str, complete_var: str, shell: str) -> str
if shell == "bash":
return f'eval "$({complete_var}=source_bash {prog_name})"'
elif shell == "zsh":
return f'eval "$({complete_var}=source_szh {prog_name})"'
return f'eval "$({complete_var}=source_zsh {prog_name})"'
elif shell == "fish":
return f"eval (env {complete_var}=source_fish {prog_name})"
elif shell in {"powershell", "pwsh"}:
Expand Down