dprint: add shell completions (#362139)

This commit is contained in:
Aleksana
2024-12-06 13:11:15 +08:00
committed by GitHub
+13
View File
@@ -3,6 +3,7 @@
stdenv,
fetchCrate,
rustPlatform,
installShellFiles,
testers,
nix-update-script,
dprint,
@@ -23,6 +24,18 @@ rustPlatform.buildRustPackage rec {
# every commit upstream on GitHub Actions
doCheck = false;
nativeBuildInputs = lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
installShellFiles
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
export DPRINT_CACHE_DIR="$(mktemp -d)"
installShellCompletion --cmd dprint \
--bash <($out/bin/dprint completions bash) \
--zsh <($out/bin/dprint completions zsh) \
--fish <($out/bin/dprint completions fish)
'';
passthru = {
tests.version = testers.testVersion {
inherit version;