about summary refs log tree commit diff
path: root/pkgs/development/tools/pscale
diff options
context:
space:
mode:
authorsuperherointj <5861043+superherointj@users.noreply.github.com>2022-09-05 03:31:26 -0300
committersuperherointj <5861043+superherointj@users.noreply.github.com>2022-09-10 15:39:42 -0300
commit5b1242134cbd728eb3da016e2b9722b4358b75f6 (patch)
treef3ddf8cd4eb6ecb2ab3af3cd269400946bd7deaf /pkgs/development/tools/pscale
parent4ee08b8bb25f1d5e98ab9f4c463443dfa61bee34 (diff)
downloadnixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.tar
nixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.tar.gz
nixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.tar.bz2
nixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.tar.lz
nixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.tar.xz
nixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.tar.zst
nixlib-5b1242134cbd728eb3da016e2b9722b4358b75f6.zip
pscale: add shell completion and version test
Diffstat (limited to 'pkgs/development/tools/pscale')
-rw-r--r--pkgs/development/tools/pscale/default.nix25
1 files changed, 22 insertions, 3 deletions
diff --git a/pkgs/development/tools/pscale/default.nix b/pkgs/development/tools/pscale/default.nix
index 22cad9b4270c..57a5834bc8db 100644
--- a/pkgs/development/tools/pscale/default.nix
+++ b/pkgs/development/tools/pscale/default.nix
@@ -1,4 +1,10 @@
-{ lib, buildGoModule, fetchFromGitHub }:
+{ buildGoModule
+, fetchFromGitHub
+, installShellFiles
+, lib
+, pscale
+, testers
+}:
 
 buildGoModule rec {
   pname = "pscale";
@@ -20,10 +26,23 @@ buildGoModule rec {
     "-X main.date=unknown"
   ];
 
+  nativeBuildInputs = [ installShellFiles ];
+
+  postInstall = ''
+    installShellCompletion --cmd pscale \
+      --bash <($out/bin/pscale completion bash) \
+      --fish <($out/bin/pscale completion fish) \
+      --zsh <($out/bin/pscale completion zsh)
+  '';
+
+  passthru.tests.version = testers.testVersion {
+    package = pscale;
+  };
+
   meta = with lib; {
-    homepage = "https://www.planetscale.com/";
-    changelog = "https://github.com/planetscale/cli/releases/tag/v${version}";
     description = "The CLI for PlanetScale Database";
+    changelog = "https://github.com/planetscale/cli/releases/tag/v${version}";
+    homepage = "https://www.planetscale.com/";
     license = licenses.asl20;
     maintainers = with maintainers; [ pimeys ];
   };