git aliases

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-04-23 21:06:10 +02:00
parent 603d33be22
commit 135eea9984
4 changed files with 37 additions and 50 deletions

View File

@@ -5,22 +5,31 @@
git
delta
# only works on spec arch, chage url for others
# (stdenv.mkDerivation {
# name = "easycommit";
# src = pkgs.fetchurl {
# url = "https://github.com/blackironj/easycommit/releases/download/v0.0.1/easycommit-v0.0.1-linux-amd64.tar.gz";
# sha256 = "sha256-Ip5wfVe/RzCxGGh1YFBllAn84nD7mUXbnMko+ue/C2E=";
# };
# phases = ["installPhase"];
# installPhase = ''
# mkdir -p $out/bin
# tar xf $src -C $out/
# ls -la $out
# mv $out/easycommit $out/bin/
# chmod +x $out/bin/easycommit
# '';
# })
(pkgs.writeShellScriptBin "git_monitor" ''
#!/bin/bash
# List of directories to check
directories=(
"$HOME/nix-dots"
"$HOME/shared/nx-obsidian-vault"
"$HOME/shared/HSMW/Praxis/BCAM/bolt-llmserver"
"$HOME/shared/HSMW/Praxis/BCAM/bcam-tools"
)
echo ""
for dir in "''${directories[@]}"; do
if [ -d "$dir" ]; then
cd "$dir" || { echo "Cannot change directory to $dir"; exit 1; }
echo "$(echo $dir | rev | cut -f 1 -d'/' | rev):"
gst
echo ""
cd - > /dev/null || { echo "Cannot change back to the original directory"; exit 1; }
else
echo "Directory $dir does not exist."
fi
done
'')
(writeShellScriptBin "gst" "awk -vOFS='' 'NR==FNR {all[i++] = $0; difffiles[$1] = $0; next;} ! ($2 in difffiles) {print; next;} {gsub($2, difffiles[$2]); print;} END {if (NR != FNR) {exit;} for (i in all) {print all[i];}}' <(git diff --color --stat=$(($(tput cols) - 3)) HEAD | sed '$d; s/^ //') <(git -c color.status=always status -sb)")
];
programs.git = {