From f277c9494ef2c48ef33b2b2f354fb60a24b29787 Mon Sep 17 00:00:00 2001 From: William Kral Date: Thu, 19 Oct 2023 16:18:49 -0700 Subject: [PATCH] leetcode-cli: Add shell completions --- pkgs/applications/misc/leetcode-cli/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/applications/misc/leetcode-cli/default.nix b/pkgs/applications/misc/leetcode-cli/default.nix index be9102b6120b..4ea55b39c531 100644 --- a/pkgs/applications/misc/leetcode-cli/default.nix +++ b/pkgs/applications/misc/leetcode-cli/default.nix @@ -2,6 +2,7 @@ , fetchCrate , rustPlatform , pkg-config +, installShellFiles , openssl , dbus , sqlite @@ -24,6 +25,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config + installShellFiles ]; buildInputs = [ @@ -32,6 +34,13 @@ rustPlatform.buildRustPackage rec { sqlite ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + postInstall = '' + installShellCompletion --cmd leetcode \ + --bash <($out/bin/leetcode completions bash) \ + --fish <($out/bin/leetcode completions fish) \ + --zsh <($out/bin/leetcode completions zsh) + ''; + passthru.tests = testers.testVersion { package = leetcode-cli; command = "leetcode -V";