From 7a1656b23006f6573b0ff29f8890a5d55295216e Mon Sep 17 00:00:00 2001 From: Zane Dufour Date: Tue, 19 Nov 2024 10:07:47 -0500 Subject: [PATCH] spacectl: add shell completions recommendations Co-authored-by: seth Update pkgs/by-name/sp/spacectl/package.nix Co-authored-by: seth Update pkgs/by-name/sp/spacectl/package.nix Co-authored-by: Bruno BELANYI nixfmt --- pkgs/by-name/sp/spacectl/package.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/by-name/sp/spacectl/package.nix b/pkgs/by-name/sp/spacectl/package.nix index 2684a7708f15..59d40610178f 100644 --- a/pkgs/by-name/sp/spacectl/package.nix +++ b/pkgs/by-name/sp/spacectl/package.nix @@ -1,7 +1,10 @@ { lib, + stdenv, buildGoModule, fetchFromGitHub, + installShellFiles, + buildPackages, }: buildGoModule rec { @@ -17,6 +20,19 @@ buildGoModule rec { vendorHash = "sha256-SYfXG6YM0Q2rCnoTM2tYvE17uBCD8yQiW/5DTCxMPWo="; + nativeBuildInputs = [ installShellFiles ]; + + postInstall = + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd spacectl \ + --bash <(${emulator} $out/bin/spacectl completion bash) \ + --fish <(${emulator} $out/bin/spacectl completion fish) \ + --zsh <(${emulator} $out/bin/spacectl completion zsh) \ + ''; + meta = { homepage = "https://github.com/spacelift-io/spacectl"; description = "Spacelift client and CLI";