summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/gh/package.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gh/package.py b/var/spack/repos/builtin/packages/gh/package.py
index 90f40c6313..dd89fe3686 100644
--- a/var/spack/repos/builtin/packages/gh/package.py
+++ b/var/spack/repos/builtin/packages/gh/package.py
@@ -50,3 +50,19 @@ class GoBuilder(spack.build_systems.go.GoBuilder):
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)