Skip to content

Commit 769e9c2

Browse files
authored
zizmor: add shell completions (#412362)
2 parents 01d0f71 + d6159f3 commit 769e9c2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkgs/by-name/zi/zizmor/package.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
lib,
3+
stdenv,
34
fetchFromGitHub,
5+
installShellFiles,
46
nix-update-script,
57
rustPlatform,
68
versionCheckHook,
@@ -20,6 +22,17 @@ rustPlatform.buildRustPackage (finalAttrs: {
2022
useFetchCargoVendor = true;
2123
cargoHash = "sha256-OVGaHLA/VzF8wGrWrHaKpYDcp4ZeR9mf2s5I+u5ddcs=";
2224

25+
nativeBuildInputs = lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
26+
installShellFiles
27+
];
28+
29+
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
30+
installShellCompletion --cmd zizmor \
31+
--bash <("$out/bin/zizmor" --completions bash) \
32+
--zsh <("$out/bin/zizmor" --completions zsh) \
33+
--fish <("$out/bin/zizmor" --completions fish)
34+
'';
35+
2336
nativeInstallCheckInputs = [ versionCheckHook ];
2437

2538
doInstallCheck = true;

0 commit comments

Comments
 (0)