Unverified Commit b75137a4 authored by Nikolay Korotkiy's avatar Nikolay Korotkiy Committed by GitHub
Browse files

crush: add shell completions support (#506817)

parents cc2aab68 4814fd21
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildGo126Module,
  fetchFromGitHub,
  installShellFiles,
  nix-update-script,
  writableTmpDirAsHomeHook,
  versionCheckHook,
@@ -25,6 +27,10 @@ buildGo126Module (finalAttrs: {
    "-X=github.com/charmbracelet/crush/internal/version.Version=${finalAttrs.version}"
  ];

  nativeBuildInputs = [
    installShellFiles
  ];

  checkFlags =
    let
      # these tests fail in the sandbox
@@ -44,6 +50,13 @@ buildGo126Module (finalAttrs: {
  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd crush \
      --bash <($out/bin/crush completion bash) \
      --fish <($out/bin/crush completion fish) \
      --zsh <($out/bin/crush completion zsh)
  '';

  updateScript = nix-update-script { };

  meta = {