glow: install shell completions (#257282)

* glow: install shell completions

---------

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
thenbe 2023-09-26 23:08:20 +03:00 committed by GitHub
parent ba07d33843
commit ca37d3417e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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";