mcat-unwrapped: add shell completions (#415029)

This commit is contained in:
h7x4
2025-09-20 22:18:04 +00:00
committed by GitHub
2 changed files with 23 additions and 0 deletions
@@ -2,6 +2,9 @@
lib,
rustPlatform,
fetchFromGitHub,
installShellFiles,
stdenv,
buildPackages,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
@@ -17,6 +20,25 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-c3OJURz6eObjIC6AHUP6l/a5zYFV0QZ3VIxShFCcm4U=";
nativeBuildInputs = [
installShellFiles
];
postInstall =
let
mcat =
if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
placeholder "out"
else
buildPackages.mcat-unwrapped;
in
''
installShellCompletion --cmd mcat \
--bash <(${mcat}/bin/mcat --generate bash) \
--fish <(${mcat}/bin/mcat --generate fish) \
--zsh <(${mcat}/bin/mcat --generate zsh)
'';
passthru = {
updateScript = nix-update-script { };
};
+1
View File
@@ -18,6 +18,7 @@ runCommand "mcat"
}
''
mkdir -p $out/bin
ln -s "${mcat-unwrapped}/share" "$out/share"
makeWrapper ${lib.getExe mcat-unwrapped} $out/bin/mcat --prefix PATH : ${
lib.makeBinPath ((lib.optional useChromium chromium) ++ (lib.optional useFfmpeg ffmpeg-headless))
}