beans: add shell completions
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
stdenv,
|
||||
versionCheckHook,
|
||||
}:
|
||||
|
||||
@@ -18,6 +20,8 @@ buildGoModule (finalAttrs: {
|
||||
|
||||
vendorHash = "sha256-TprfPZ/clb7PLMAkxF0y78bCef4XarhgHlIhIPn1nQA=";
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-X github.com/hmans/beans/cmd.version=${finalAttrs.version}"
|
||||
@@ -25,6 +29,13 @@ buildGoModule (finalAttrs: {
|
||||
"-X github.com/hmans/beans/cmd.date=unknown"
|
||||
];
|
||||
|
||||
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd beans \
|
||||
--bash <($out/bin/beans completion bash) \
|
||||
--fish <($out/bin/beans completion fish) \
|
||||
--zsh <($out/bin/beans completion zsh)
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "version";
|
||||
|
||||
Reference in New Issue
Block a user