about summary refs log tree commit diff
path: root/pkgs/development/tools/tokio-console
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2024-03-26 04:20:00 +0000
committerMario Rodas <marsam@users.noreply.github.com>2024-03-26 04:20:00 +0000
commit8f19a5443f9b48b9260c0aa0d846c561c0c6189c (patch)
treea7b0f8386f1e354778c7cd07cc355e4636b7f60a /pkgs/development/tools/tokio-console
parent7940420063924296a0061a69994c572fc8d147a5 (diff)
tokio-console: install completions
Diffstat (limited to 'pkgs/development/tools/tokio-console')
-rw-r--r--pkgs/development/tools/tokio-console/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/development/tools/tokio-console/default.nix b/pkgs/development/tools/tokio-console/default.nix
index 7d65f382f9575..c37bf85de9754 100644
--- a/pkgs/development/tools/tokio-console/default.nix
+++ b/pkgs/development/tools/tokio-console/default.nix
@@ -1,5 +1,6 @@
 { lib
 , fetchFromGitHub
+, installShellFiles
 , rustPlatform
 , protobuf
 }:
@@ -17,7 +18,10 @@ rustPlatform.buildRustPackage rec {
 
   cargoHash = "sha256-86KQpRpYSCQs6SUeG0HV26b58x/QUyovoL+5fg8JCOI=";
 
-  nativeBuildInputs = [ protobuf ];
+  nativeBuildInputs = [
+    installShellFiles
+    protobuf
+  ];
 
   # uses currently unstable tokio features
   RUSTFLAGS = "--cfg tokio_unstable";
@@ -29,6 +33,13 @@ rustPlatform.buildRustPackage rec {
     "--skip config::tests::toml_example_changed"
   ];
 
+  postInstall = ''
+    installShellCompletion --cmd tokio-console \
+      --bash <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion bash) \
+      --fish <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion fish) \
+      --zsh <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion zsh)
+  '';
+
   meta = with lib; {
     description = "A debugger for asynchronous Rust code";
     homepage = "https://github.com/tokio-rs/console";