From ca37d3417ea7bb95c48100e9ed038900bd4cdf37 Mon Sep 17 00:00:00 2001 From: thenbe <33713262+thenbe@users.noreply.github.com> Date: Tue, 26 Sep 2023 23:08:20 +0300 Subject: [PATCH] glow: install shell completions (#257282) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * glow: install shell completions --------- Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com> Co-authored-by: Jörg Thalheim --- pkgs/applications/editors/glow/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/applications/editors/glow/default.nix b/pkgs/applications/editors/glow/default.nix index cbd63c0ffcd0..fde2bebe5e4e 100644 --- a/pkgs/applications/editors/glow/default.nix +++ b/pkgs/applications/editors/glow/default.nix @@ -1,6 +1,8 @@ { lib , buildGoModule , fetchFromGitHub +, installShellFiles +, stdenv }: buildGoModule rec { pname = "glow"; @@ -19,6 +21,14 @@ buildGoModule rec { ldflags = [ "-s" "-w" "-X=main.Version=${version}" ]; + nativeBuildInputs = [ installShellFiles ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd glow \ + --bash <($out/bin/glow completion bash) \ + --fish <($out/bin/glow completion fish) \ + --zsh <($out/bin/glow completion zsh) + ''; + meta = with lib; { description = "Render markdown on the CLI, with pizzazz!"; homepage = "https://github.com/charmbracelet/glow";