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 = {

View File

@@ -1,33 +0,0 @@
{ config, pkgs, ...}:
{
home.packages = with pkgs; [
waybar
(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"
)
for dir in "''${directories[@]}"; do
echo "Checking git status in $dir"
# Check if the directory exists
if [ -d "$dir" ]; then
# Change directory and run git status
cd "$dir" || { echo "Cannot change directory to $dir"; exit 1; }
git status
# Change back to the original directory
cd - > /dev/null || { echo "Cannot change back to the original directory"; exit 1; }
else
echo "Directory $dir does not exist."
fi
done
'')
];
}

View File

@@ -52,6 +52,18 @@
nn = "nano";
m = "micro";
c = "codium";
g = "git";
# gst = "git status";
gps = "git push";
gpl = "git pull";
gad = "git add";
gcm = "git commit -m ";
gsh = "git stash";
gsp = "git stash pop";
glg = "git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --all";
gll = "git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'";
gmt = "git_monitor";
code = "codium";
# ya = "yazi"; # function
nxfiglet = "figlet";