ddev: install autocompletion scripts (#384953)

This commit is contained in:
Peder Bergebakken Sundt
2025-03-04 00:56:24 +01:00
committed by GitHub
+24 -1
View File
@@ -1,4 +1,12 @@
{ lib, buildGoModule, fetchFromGitHub, testers, ddev }:
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
testers,
ddev,
}:
buildGoModule rec {
pname = "ddev";
@@ -11,6 +19,10 @@ buildGoModule rec {
hash = "sha256-q1bLnwVNFAtnG5tCn7ox4lgaXM60rrVEcWgBNuRJcSU=";
};
nativeBuildInputs = [
installShellFiles
];
vendorHash = null;
ldflags = [
@@ -22,6 +34,17 @@ buildGoModule rec {
# Tests need docker.
doCheck = false;
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# DDEV will try to create $HOME/.ddev, so we set $HOME to a temporary
# directory.
export HOME=$(mktemp -d)
$out/bin/ddev_gen_autocomplete
installShellCompletion --cmd ddev \
--bash .gotmp/bin/completions/ddev_bash_completion.sh \
--fish .gotmp/bin/completions/ddev_fish_completion.sh \
--zsh .gotmp/bin/completions/ddev_zsh_completion.sh
'';
passthru.tests.version = testers.testVersion {
package = ddev;
command = ''