jwt-cli: install shell completion

This commit is contained in:
Robert Helgesson 2024-06-01 21:53:05 +02:00
parent fcc28ac90a
commit efc32e7a1c

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, rustPlatform, Security }:
{ lib, stdenv, fetchFromGitHub, installShellFiles, rustPlatform, Security }:
rustPlatform.buildRustPackage rec {
pname = "jwt-cli";
@ -13,8 +13,17 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-DXyjdwVJUQpOz/Pctl35D00oSgrfehUg8wYyLdttiew=";
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optional stdenv.isDarwin Security;
postInstall = ''
installShellCompletion --cmd jwt \
--bash <($out/bin/jwt completion bash) \
--fish <($out/bin/jwt completion fish) \
--zsh <($out/bin/jwt completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/jwt --version > /dev/null