home/git: add diffc script

This commit is contained in:
2025-12-29 17:58:01 +09:00
parent 5bd5355150
commit d6e83cb4c4

View File

@@ -362,6 +362,19 @@ lib.mkIf cfg.enable {
runtimeInputs = with pkgs; [ cfg.package gnugrep gawk findutils uutils-coreutils-noprefix ];
text = lib.fileContents ./scripts/git-all-commits.sh;
})
(pkgs.writeShellApplication {
name = "git-diffc";
runtimeInputs = with pkgs; [ cfg.package gawk ];
text = let
printfLiteral = lib.concatStrings [
"\\033[36m%s\\033[0m\\n"
"\\033[32m%s\\033[0m\\n"
"\\033[31m%s\\033[0m\\n"
];
in ''
git --no-pager diff --shortstat "$@" | awk -F',' '{ printf "${printfLiteral}", $1, $2 ? $2 : "", $3 ? $3 : ""; }'
'';
})
((pkgs.writers.writePython3Bin "git-post-pr" {
libraries = with pkgs.python3Packages; [
tkinter