Skip to content

Commit afac2b8

Browse files
svlandegpre-commit-ci[bot]tiangolo
authored
🐛 Fix sourcing of completion path for Git Bash (#801)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastián Ramírez <[email protected]>
1 parent 6b35a70 commit afac2b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

typer/_completion_shared.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ def install_bash(*, prog_name: str, complete_var: str, shell: str) -> Path:
100100
# It seems bash-completion is the official completion system for bash:
101101
# Ref: https://www.gnu.org/software/bash/manual/html_node/A-Programmable-Completion-Example.html
102102
# But installing in the locations from the docs doesn't seem to have effect
103-
completion_path = Path.home() / f".bash_completions/{prog_name}.sh"
103+
completion_path = Path.home() / ".bash_completions" / f"{prog_name}.sh"
104104
rc_path = Path.home() / ".bashrc"
105105
rc_path.parent.mkdir(parents=True, exist_ok=True)
106106
rc_content = ""
107107
if rc_path.is_file():
108108
rc_content = rc_path.read_text()
109-
completion_init_lines = [f"source {completion_path}"]
109+
completion_init_lines = [f"source '{completion_path}'"]
110110
for line in completion_init_lines:
111111
if line not in rc_content: # pragma: no cover
112112
rc_content += f"\n{line}"

0 commit comments

Comments
 (0)