3
0
Fork 0
forked from mirrors/nixpkgs

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 { lib
, stdenv
, buildPackages
, buildGoModule , buildGoModule
, fetchFromGitHub , fetchFromGitHub
, installShellFiles
}: }:
buildGoModule rec { buildGoModule rec {
@ -22,6 +25,19 @@ buildGoModule rec {
"-X=github.com/reproducible-containers/diffoci/cmd/diffoci/version.Version=v${version}" "-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; { meta = with lib; {
description = "Diff for Docker and OCI container images"; description = "Diff for Docker and OCI container images";
homepage = "https://github.com/reproducible-containers/diffoci/"; homepage = "https://github.com/reproducible-containers/diffoci/";