Merge pull request #268059 from twz123/trivy-shell-completions

trivy: add shell completions

authored by Mario Rodas and committed by GitHub 2c262fad 1373260b

+17
+17
pkgs/tools/admin/trivy/default.nix
··· 1 { lib 2 , buildGoModule 3 , fetchFromGitHub 4 , testers 5 , trivy 6 }: ··· 29 "-X=github.com/aquasecurity/trivy/pkg/version.ver=v${version}" 30 ]; 31 32 # Tests require network access 33 doCheck = false; 34 35 doInstallCheck = true; 36 37 passthru.tests.version = testers.testVersion { ··· 51 vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and 52 application dependencies (Bundler, Composer, npm, yarn, etc.). 53 ''; 54 license = licenses.asl20; 55 maintainers = with maintainers; [ fab jk ]; 56 };
··· 1 { lib 2 + , stdenv 3 + , buildPackages 4 , buildGoModule 5 , fetchFromGitHub 6 + , installShellFiles 7 , testers 8 , trivy 9 }: ··· 32 "-X=github.com/aquasecurity/trivy/pkg/version.ver=v${version}" 33 ]; 34 35 + nativeBuildInputs = [ installShellFiles ]; 36 + 37 # Tests require network access 38 doCheck = false; 39 40 + postInstall = 41 + let 42 + trivy = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then placeholder "out" else buildPackages.trivy; 43 + in 44 + '' 45 + installShellCompletion --cmd trivy \ 46 + --bash <(${trivy}/bin/trivy completion bash) \ 47 + --fish <(${trivy}/bin/trivy completion fish) \ 48 + --zsh <(${trivy}/bin/trivy completion zsh) 49 + ''; 50 + 51 doInstallCheck = true; 52 53 passthru.tests.version = testers.testVersion { ··· 67 vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and 68 application dependencies (Bundler, Composer, npm, yarn, etc.). 69 ''; 70 + mainProgram = "trivy"; 71 license = licenses.asl20; 72 maintainers = with maintainers; [ fab jk ]; 73 };