From f0ba6d64bffbda8130de19dbc89cbb9934816e92 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sat, 6 Sep 2025 13:19:17 +0200 Subject: [PATCH] tea: Install shell completions for bash, zsh and fish (#334848) * install shell completions for `tea` * set compiletime version --- pkgs/by-name/te/tea/package.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/by-name/te/tea/package.nix b/pkgs/by-name/te/tea/package.nix index 8ca3ebe7c6e6..00faa35624e8 100644 --- a/pkgs/by-name/te/tea/package.nix +++ b/pkgs/by-name/te/tea/package.nix @@ -2,6 +2,7 @@ lib, buildGoModule, fetchFromGitea, + installShellFiles, }: buildGoModule rec { @@ -28,4 +29,20 @@ buildGoModule rec { ]; mainProgram = "tea"; }; + + ldflags = [ + "-X code.gitea.io/tea/cmd.Version=${version}" + ]; + + nativeBuildInputs = [ installShellFiles ]; + + postInstall = '' + installShellCompletion --cmd tea \ + --bash <($out/bin/tea completion bash) \ + --fish <($out/bin/tea completion fish) \ + --zsh <($out/bin/tea completion zsh) + + mkdir $out/share/powershell/ -p + $out/bin/tea completion pwsh > $out/share/powershell/tea.Completion.ps1 + ''; }