From e8380aae72d9c96b277a2feda8c8626e45625ea0 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Fri, 19 Apr 2024 17:49:26 +0200 Subject: [PATCH 1/2] fix sourcing completion path for Git Bash --- typer/_completion_shared.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typer/_completion_shared.py b/typer/_completion_shared.py index 10de54420d..55c4697225 100644 --- a/typer/_completion_shared.py +++ b/typer/_completion_shared.py @@ -100,13 +100,13 @@ def install_bash(*, prog_name: str, complete_var: str, shell: str) -> Path: # It seems bash-completion is the official completion system for bash: # Ref: https://www.gnu.org/software/bash/manual/html_node/A-Programmable-Completion-Example.html # But installing in the locations from the docs doesn't seem to have effect - completion_path = Path.home() / f".bash_completions/{prog_name}.sh" + completion_path = Path.home() / f".bash_completions" / f"{prog_name}.sh" rc_path = Path.home() / ".bashrc" rc_path.parent.mkdir(parents=True, exist_ok=True) rc_content = "" if rc_path.is_file(): rc_content = rc_path.read_text() - completion_init_lines = [f"source {completion_path}"] + completion_init_lines = [f"source '{completion_path}'"] for line in completion_init_lines: if line not in rc_content: # pragma: no cover rc_content += f"\n{line}" From 6b2e6fee531b0dd74cd8030de1d1baf6d9177a0f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:56:40 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20for?= =?UTF-8?q?mat=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typer/_completion_shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typer/_completion_shared.py b/typer/_completion_shared.py index 55c4697225..beec05e627 100644 --- a/typer/_completion_shared.py +++ b/typer/_completion_shared.py @@ -100,7 +100,7 @@ def install_bash(*, prog_name: str, complete_var: str, shell: str) -> Path: # It seems bash-completion is the official completion system for bash: # Ref: https://www.gnu.org/software/bash/manual/html_node/A-Programmable-Completion-Example.html # But installing in the locations from the docs doesn't seem to have effect - completion_path = Path.home() / f".bash_completions" / f"{prog_name}.sh" + completion_path = Path.home() / ".bash_completions" / f"{prog_name}.sh" rc_path = Path.home() / ".bashrc" rc_path.parent.mkdir(parents=True, exist_ok=True) rc_content = ""