summary refs log tree commit diff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/hcloud/default.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/development/tools/hcloud/default.nix b/pkgs/development/tools/hcloud/default.nix
index 877080508d40..b3fa6f852f76 100644
--- a/pkgs/development/tools/hcloud/default.nix
+++ b/pkgs/development/tools/hcloud/default.nix
@@ -14,6 +14,19 @@ buildGoPackage rec {
 
   buildFlagsArray = [ "-ldflags=" "-w -X github.com/hetznercloud/cli/cli.Version=${version}" ];
 
+  postInstall = ''
+    mkdir -p \
+      $bin/etc/bash_completion.d \
+      $bin/share/zsh/vendor-completions
+
+    # Add bash completions
+    $bin/bin/hcloud completion bash > "$bin/etc/bash_completion.d/hcloud"
+
+    # Add zsh completions
+    echo "#compdef hcloud" > "$bin/share/zsh/vendor-completions/_hcloud"
+    $bin/bin/hcloud completion zsh >> "$bin/share/zsh/vendor-completions/_hcloud"
+  '';
+
   meta = {
     description = "A command-line interface for Hetzner Cloud, a provider for cloud virtual private servers";
     homepage = https://github.com/hetznercloud/cli;