spicedb: add shell completion

This commit adds shell completion for bash, fish, and zsh to both
spicedb and zed, leveraging their `completion` subcommands with bash
process substitution.

Signed-off-by: squat <lserven@gmail.com>
This commit is contained in:
squat
2025-05-06 17:31:33 +02:00
parent d6abbec93e
commit 66afc79dcd
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -2,6 +2,7 @@
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
buildGoModule rec {
@@ -23,6 +24,15 @@ buildGoModule rec {
subPackages = [ "cmd/spicedb" ];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd spicedb \
--bash <($out/bin/spicedb completion bash) \
--fish <($out/bin/spicedb completion fish) \
--zsh <($out/bin/spicedb completion zsh)
'';
meta = with lib; {
description = "Open source permission database";
longDescription = ''
+10
View File
@@ -2,6 +2,7 @@
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
buildGoModule rec {
@@ -21,6 +22,15 @@ buildGoModule rec {
"-X 'github.com/jzelinskie/cobrautil/v2.Version=${src.rev}'"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd zed \
--bash <($out/bin/zed completion bash) \
--fish <($out/bin/zed completion fish) \
--zsh <($out/bin/zed completion zsh)
'';
meta = with lib; {
description = "Command line for managing SpiceDB";
mainProgram = "zed";