Skip to content
Myr

🐛 Fix sourcing of completion path for Git Bash (#801)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sofie Van Landeghem · committed by GitHub · parent 6b35a70 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:typer/_completion_shared.py+2 added-2 removed
98 unmodified lines
99 # Ref: https://github.com/scop/bash-completion#faq100 # It seems bash-completion is the official completion system for bash:101 # Ref: https://www.gnu.org/software/bash/manual/html_node/A-Programmable-Completion-Example.html102 # But installing in the locations from the docs doesn't seem to have effect103 completion_path = Path.home() / f".bash_completions/{prog_name}.sh"103 completion_path = Path.home() / ".bash_completions" / f"{prog_name}.sh"104 rc_path = Path.home() / ".bashrc"105 rc_path.parent.mkdir(parents=True, exist_ok=True)106 rc_content = ""107 if rc_path.is_file():108 rc_content = rc_path.read_text()109 completion_init_lines = [f"source {completion_path}"]109 completion_init_lines = [f"source '{completion_path}'"]110 for line in completion_init_lines:111 if line not in rc_content: # pragma: no cover112 rc_content += f"\n{line}"113 rc_content += "\n"
127 unmodified lines