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 1 { lib 2 + , stdenv 3 + , buildPackages 2 4 , buildGoModule 3 5 , fetchFromGitHub 6 + , installShellFiles 4 7 , testers 5 8 , trivy 6 9 }: ··· 29 32 "-X=github.com/aquasecurity/trivy/pkg/version.ver=v${version}" 30 33 ]; 31 34 35 + nativeBuildInputs = [ installShellFiles ]; 36 + 32 37 # Tests require network access 33 38 doCheck = false; 34 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 + 35 51 doInstallCheck = true; 36 52 37 53 passthru.tests.version = testers.testVersion { ··· 51 67 vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and 52 68 application dependencies (Bundler, Composer, npm, yarn, etc.). 53 69 ''; 70 + mainProgram = "trivy"; 54 71 license = licenses.asl20; 55 72 maintainers = with maintainers; [ fab jk ]; 56 73 };