Unverified Commit 1bdb7730 authored by Ramses's avatar Ramses Committed by GitHub
Browse files

bash-preexec: improve overridability (#441252)

parents 6d7ec06d d41b40c7
Loading
Loading
Loading
Loading
+18 −9
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ stdenvNoCC.mkDerivation {
  src = fetchFromGitHub {
    owner = "rcaloras";
    repo = "bash-preexec";
    rev = version;
    sha256 = "sha256-4DzbeIiUX7iXy2CeSvRC2X+XnjVk+/UiMbM/dLHx7zU=";
    tag = version;
    hash = "sha256-4DzbeIiUX7iXy2CeSvRC2X+XnjVk+/UiMbM/dLHx7zU=";
  };

  nativeCheckInputs = [ bats ];
@@ -26,30 +26,39 @@ stdenvNoCC.mkDerivation {
  dontBuild = true;

  patchPhase = ''
    runHook prePatch

    # Needed since the tests expect that HISTCONTROL is set.
    sed -i '/setup()/a HISTCONTROL=""' test/bash-preexec.bats

    # Skip tests failing with Bats 1.5.0.
    # See https://github.com/rcaloras/bash-preexec/issues/121
    sed -i '/^@test.*IFS/,/^}/d' test/bash-preexec.bats

    runHook postPatch
  '';

  checkPhase = ''
    runHook preCheck
    bats test
    runHook postCheck
  '';

  installPhase = ''
    install -Dm755 $src/bash-preexec.sh $out/share/bash/bash-preexec.sh
    runHook preInstall
    install -Dm755 bash-preexec.sh $out/share/bash/bash-preexec.sh
    runHook postInstall
  '';

  meta = with lib; {
  meta = {
    description = "Preexec and precmd functions for Bash just like Zsh";
    license = licenses.mit;
    license = lib.licenses.mit;
    homepage = "https://github.com/rcaloras/bash-preexec";
    maintainers = [
      maintainers.hawkw
      maintainers.rycee
    changelog = "https://github.com/rcaloras/bash-preexec/releases/tag/${version}";
    maintainers = with lib.maintainers; [
      hawkw
      rycee
    ];
    platforms = platforms.unix;
    platforms = lib.platforms.unix;
  };
}