From c6914f42d8400b68e24c9bdadc7d6c9dfe94d441 Mon Sep 17 00:00:00 2001 From: oliwia Date: Thu, 2 Jul 2026 00:16:19 +0200 Subject: [PATCH] air-formatter: add shell completions --- pkgs/by-name/ai/air-formatter/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/ai/air-formatter/package.nix b/pkgs/by-name/ai/air-formatter/package.nix index 383a59b4a058..7ecf545ef2a3 100644 --- a/pkgs/by-name/ai/air-formatter/package.nix +++ b/pkgs/by-name/ai/air-formatter/package.nix @@ -4,6 +4,7 @@ fetchFromGitHub, versionCheckHook, nix-update-script, + installShellFiles, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "air-formatter"; @@ -32,6 +33,16 @@ rustPlatform.buildRustPackage (finalAttrs: { updateScript = nix-update-script { }; }; + nativeBuildInputs = [ installShellFiles ]; + # TODO: Upstream also provides Elvish and PowerShell completions, + # but `installShellCompletion` only has support for Bash, Zsh and Fish at the moment. + postInstall = '' + installShellCompletion --cmd air-formatter \ + --bash <($out/bin/air generate-shell-completion bash) \ + --fish <($out/bin/air generate-shell-completion fish) \ + --zsh <($out/bin/air generate-shell-completion zsh) + ''; + meta = { description = "Extremely fast R code formatter"; homepage = "https://posit-dev.github.io/air";