diffoci: Add shell completions

This commit is contained in:
Tom Wieczorek 2023-10-28 13:22:39 +02:00
parent 76e6b5805d
commit 198c47dd90
No known key found for this signature in database
GPG Key ID: FE33A2282371E831

View File

@ -1,6 +1,9 @@
{ lib
, stdenv
, buildPackages
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:
buildGoModule rec {
@ -22,6 +25,19 @@ buildGoModule rec {
"-X=github.com/reproducible-containers/diffoci/cmd/diffoci/version.Version=v${version}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall =
let
diffoci = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then placeholder "out" else buildPackages.diffoci;
in
''
installShellCompletion --cmd trivy \
--bash <(${diffoci}/bin/diffoci completion bash) \
--fish <(${diffoci}/bin/diffoci completion fish) \
--zsh <(${diffoci}/bin/diffoci completion zsh)
'';
meta = with lib; {
description = "Diff for Docker and OCI container images";
homepage = "https://github.com/reproducible-containers/diffoci/";