pkgs: simplify git-multi-shortlog
package using trivial builder
While at it, fix SC2164 Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
b946d107c9
commit
f9f334eef5
|
@ -1,7 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
generate-shortlog() {
|
||||
local hash
|
||||
hash="$(git log --format=%h -"$1" | tail -n1)"
|
||||
|
@ -67,12 +63,12 @@ for repo in "$@"; do
|
|||
exit 102
|
||||
fi
|
||||
|
||||
pushd "$dir" >/dev/null
|
||||
pushd "$dir" >/dev/null || exit
|
||||
git checkout --quiet "$branch"
|
||||
out="$out$(basename "$PWD"):\n\n"
|
||||
out="$out$(generate-shortlog "$depth")\n\n"
|
||||
git checkout --quiet -
|
||||
popd >/dev/null
|
||||
popd >/dev/null || exit
|
||||
done
|
||||
|
||||
echo -ne "${out::-2}"
|
||||
|
|
|
@ -1,25 +1,7 @@
|
|||
{ lib, pkgs, stdenvNoCC }:
|
||||
{ pkgs, writeShellApplication }:
|
||||
|
||||
let binDeps = with pkgs; [ coreutils git wl-clipboard ];
|
||||
in stdenvNoCC.mkDerivation rec {
|
||||
pname = "git-multi-shortlog";
|
||||
version = "0.1.0";
|
||||
|
||||
phases = [ "checkPhase" "installPhase" "fixupPhase" ];
|
||||
|
||||
doCheck = true;
|
||||
nativeCheckInputs = [ pkgs.shellcheck ];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
shellcheck --shell bash ${../extra/bin/git-multi-shortlog.sh}
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -D -m555 ${../extra/bin/git-multi-shortlog.sh} $out/bin/${pname}
|
||||
wrapProgram $out/bin/${pname} --set PATH "${lib.makeBinPath binDeps}"
|
||||
runHook postInstall
|
||||
'';
|
||||
writeShellApplication {
|
||||
name = "git-multi-shortlog";
|
||||
runtimeInputs = with pkgs; [ coreutils git wl-clipboard ];
|
||||
text = builtins.readFile ../extra/bin/git-multi-shortlog.sh;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue