doctl: install shell completion

This commit is contained in:
zowoq 2020-04-10 22:19:42 +10:00
parent e6d4b95fed
commit dcbe2aa300

View File

@ -1,4 +1,4 @@
{ lib, buildGoPackage, fetchFromGitHub }: { lib, buildGoPackage, fetchFromGitHub, installShellFiles }:
buildGoPackage rec { buildGoPackage rec {
pname = "doctl"; pname = "doctl";
@ -16,6 +16,16 @@ buildGoPackage rec {
-X ${goPackagePath}.Label=release -X ${goPackagePath}.Label=release
''; '';
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
export HOME=$(mktemp -d) # attempts to write to /homeless-shelter
for shell in bash fish zsh; do
$bin/bin/doctl completion $shell > doctl.$shell
installShellCompletion doctl.$shell
done
'';
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "digitalocean"; owner = "digitalocean";
repo = "doctl"; repo = "doctl";