Merge pull request #268059 from twz123/trivy-shell-completions
trivy: add shell completions
This commit is contained in:
commit
2c262faddb
1 changed files with 17 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, buildPackages
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, installShellFiles
|
||||
, testers
|
||||
, trivy
|
||||
}:
|
||||
|
@ -29,9 +32,22 @@ buildGoModule rec {
|
|||
"-X=github.com/aquasecurity/trivy/pkg/version.ver=v${version}"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
# Tests require network access
|
||||
doCheck = false;
|
||||
|
||||
postInstall =
|
||||
let
|
||||
trivy = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then placeholder "out" else buildPackages.trivy;
|
||||
in
|
||||
''
|
||||
installShellCompletion --cmd trivy \
|
||||
--bash <(${trivy}/bin/trivy completion bash) \
|
||||
--fish <(${trivy}/bin/trivy completion fish) \
|
||||
--zsh <(${trivy}/bin/trivy completion zsh)
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
|
@ -51,6 +67,7 @@ buildGoModule rec {
|
|||
vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and
|
||||
application dependencies (Bundler, Composer, npm, yarn, etc.).
|
||||
'';
|
||||
mainProgram = "trivy";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ fab jk ];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue