Skip to content

Commit

Permalink
🐛 Fix Zsh completion install
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Mar 18, 2020
1 parent 5a6379f commit 1f54532
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

1 comment on commit 1f54532

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.