git-prole: add shell completions

This commit is contained in:
Axel Karjalainen 2025-04-10 01:29:38 +03:00
parent 4d82b26c6a
commit 298aa40f23

View file

@ -1,12 +1,16 @@
{
lib,
stdenv,
buildPackages,
fetchFromGitHub,
rustPlatform,
git,
bash,
nix-update-script,
installShellFiles,
}:
let
emulatorAvailable = stdenv.hostPlatform.emulatorAvailable buildPackages;
emulator = stdenv.hostPlatform.emulator buildPackages;
version = "0.5.3";
in
rustPlatform.buildRustPackage {
@ -20,14 +24,32 @@ rustPlatform.buildRustPackage {
hash = "sha256-QwLkByC8gdAnt6geZS285ErdH8nfV3vsWjMF4hTzq9Y=";
};
buildFeatures = [ "clap_mangen" ];
useFetchCargoVendor = true;
cargoHash = "sha256-qghc8HtJfpTYXAwC2xjq8lLlCu419Ttnu/AYapkAulI=";
nativeCheckInputs = [
git
bash
];
nativeBuildInputs = [
installShellFiles
];
postInstall = lib.optionalString emulatorAvailable ''
manpages=$(mktemp -d)
${emulator} $out/bin/git-prole manpages "$manpages"
for manpage in "$manpages"/*; do
installManPage "$manpage"
done
installShellCompletion --cmd git-prole \
--bash <(${emulator} $out/bin/git-prole completions bash) \
--fish <(${emulator} $out/bin/git-prole completions fish) \
--zsh <(${emulator} $out/bin/git-prole completions zsh)
'';
meta = {
homepage = "https://github.com/9999years/git-prole";
changelog = "https://github.com/9999years/git-prole/releases/tag/v${version}";