Merge pull request #152567 from LeSuisse/rekor-shell-completions

rekor-cli, rekor-server: install shell completions
This commit is contained in:
Bobby Rong 2021-12-29 23:45:07 +08:00 committed by GitHub
commit 21466e63cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ lib, buildGoModule, fetchFromGitHub }:
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
let
generic = { pname, packageToBuild, description }:
@ -15,10 +15,19 @@ let
vendorSha256 = "sha256-XCCO4Vamzj5pJFmu1A8mpTLlVAtocrn20myYJVWtBrY=";
nativeBuildInputs = [ installShellFiles ];
subPackages = [ packageToBuild ];
ldflags = [ "-s" "-w" "-X github.com/sigstore/rekor/${packageToBuild}/app.GitVersion=v${version}" ];
postInstall = ''
installShellCompletion --cmd ${pname} \
--bash <($out/bin/${pname} completion bash) \
--fish <($out/bin/${pname} completion fish) \
--zsh <($out/bin/${pname} completion zsh)
'';
meta = with lib; {
inherit description;
homepage = "https://github.com/sigstore/rekor";