Merge pull request #143656 from figsoda/dyff-version

dyff: fix version output, install shell completions
This commit is contained in:
figsoda 2021-10-29 09:28:09 -04:00 committed by GitHub
commit 0e3f614a90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ lib, buildGoModule, fetchFromGitHub}:
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "dyff";
@ -19,6 +19,27 @@ buildGoModule rec {
"internal/cmd"
];
nativeBuildInputs = [ installShellFiles ];
# test fails with the injected version
postPatch = ''
substituteInPlace internal/cmd/cmds_test.go \
--replace "version (development)" ${version}
'';
ldflags = [
"-s"
"-w"
"-X=github.com/homeport/dyff/internal/cmd.version=${version}"
];
postInstall = ''
installShellCompletion --cmd dyff \
--bash <($out/bin/dyff completion bash) \
--fish <($out/bin/dyff completion fish) \
--zsh <($out/bin/dyff completion zsh)
'';
meta = with lib; {
description = "A diff tool for YAML files, and sometimes JSON";
longDescription = ''