dnscontrol: install shell completions

DNSControl has built-in shell completions as described
in [1]. They can be installed on disk and will be loaded by bash-completion
or zsh.

[1]: https://docs.dnscontrol.org/getting-started/getting-started#id-1.1.-shell-completion
This commit is contained in:
Mészáros Gergely 2024-06-05 12:16:33 +00:00
parent 65949ff1c8
commit 9aeb7ee069

View File

@ -1,4 +1,4 @@
{ lib, buildGoModule, fetchFromGitHub, testers, dnscontrol }:
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, testers, dnscontrol }:
buildGoModule rec {
pname = "dnscontrol";
@ -13,10 +13,18 @@ buildGoModule rec {
vendorHash = "sha256-kmnV1W0HGlxFZYYUeUd9D/zOabUhM5kDoTZTnRYJ2sM=";
nativeBuildInputs = [ installShellFiles ];
subPackages = [ "." ];
ldflags = [ "-s" "-w" "-X=main.version=${version}" ];
postInstall = ''
installShellCompletion --cmd dnscontrol \
--bash <($out/bin/dnscontrol shell-completion bash) \
--zsh <($out/bin/dnscontrol shell-completion zsh)
'';
preCheck = ''
# requires network
rm pkg/spflib/flatten_test.go pkg/spflib/parse_test.go