gh: add shell completions (#46701)

This commit is contained in:
Alec Scott 2024-10-02 06:34:30 -07:00 committed by GitHub
parent dcdc678b19
commit f92c5d7a2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,3 +50,19 @@ def build_args(self):
args = super().build_args
args.extend(["-trimpath", "./cmd/gh"])
return args
@run_after("install")
def install_completions(self):
gh = Executable(self.prefix.bin.gh)
mkdirp(bash_completion_path(self.prefix))
with open(bash_completion_path(self.prefix) / "gh", "w") as file:
gh("completion", "-s", "bash", output=file)
mkdirp(fish_completion_path(self.prefix))
with open(fish_completion_path(self.prefix) / "gh.fish", "w") as file:
gh("completion", "-s", "fish", output=file)
mkdirp(zsh_completion_path(self.prefix))
with open(zsh_completion_path(self.prefix) / "_gh", "w") as file:
gh("completion", "-s", "zsh", output=file)