summary refs log tree commit diff
path: root/pkgs/applications/misc/leetcode-cli/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/misc/leetcode-cli/default.nix')
-rw-r--r--pkgs/applications/misc/leetcode-cli/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/applications/misc/leetcode-cli/default.nix b/pkgs/applications/misc/leetcode-cli/default.nix
index be9102b6120..4ea55b39c53 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";