Unverified Commit 17caf824 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

ddev: install autocompletion scripts (#384953)

parents f6bb00a0 86275edc
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
{ 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 = ''