dua: add shell completions

This commit is contained in:
Artur Sannikov
2026-07-09 13:49:52 +03:00
parent b86de243c9
commit f939fcebba
+12
View File
@@ -1,9 +1,11 @@
{
stdenv,
lib,
rustPlatform,
fetchFromGitHub,
versionCheckHook,
nix-update-script,
installShellFiles,
}:
rustPlatform.buildRustPackage (finalAttrs: {
@@ -38,6 +40,16 @@ rustPlatform.buildRustPackage (finalAttrs: {
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# TODO: Upstream also provides Elvish and PowerShell completions,
# but `installShellCompletion` only has support for Bash, Zsh and Fish at the moment.
installShellCompletion --cmd dua \
--bash <($out/bin/dua completions bash) \
--fish <($out/bin/dua completions fish) \
--zsh <($out/bin/dua completions zsh)
'';
passthru.updateScript = nix-update-script { };
meta = {