try column aware git l

This commit is contained in:
Daylin Morgan 2024-08-06 11:30:25 -05:00
parent d74ce89b92
commit 548e77da81
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
COLUMNS=$(tput cols)
PREFIX='%C(bold magenta)%h%C(reset)'
SUFFIX='%C(dim white)%aN%C(reset)%C(auto)%d%C(reset)'
if [[ "$COLUMNS" -gt 100 ]]; then
format='%C(bold)%<(50,trunc)%s%C(reset) %C(green)%><(15,trunc)%ar%C(reset)'
else
format='%C(bold)%s%C(reset) %C(green)%as%C(reset)'
fi
format="$PREFIX $format $SUFFIX"
exec git \
log \
--format=tformat:"$format" \
"$@"

View file

@ -31,8 +31,8 @@ autosetuprebase = always
autoSetupRemote = true autoSetupRemote = true
[alias] [alias]
; l = log --format=tformat:'%C(bold magenta)%h%C(reset) %C(bold)%s%C(reset)%C(auto)%d%C(reset) %C(green)%ar%C(reset) %C(dim white)%aN%C(reset)'
adog = log --all --decorate --oneline --graph adog = log --all --decorate --oneline --graph
l = log --format=tformat:'%C(bold magenta)%h%C(reset) %C(bold)%s%C(reset)%C(auto)%d%C(reset) %C(green)%ar%C(reset) %C(dim white)%aN%C(reset)'
lf = log --graph --format=tformat:'%C(bold yellow)%h%C(reset) %C(cyan)%aD%C(reset) %C(green)(%ar) %C(dim white)%aN%C(reset)%w(0,0,9)%n %C(bold)%s%C(auto)%+d%C(reset)%w(0,0,10)%+b' lf = log --graph --format=tformat:'%C(bold yellow)%h%C(reset) %C(cyan)%aD%C(reset) %C(green)(%ar) %C(dim white)%aN%C(reset)%w(0,0,9)%n %C(bold)%s%C(auto)%+d%C(reset)%w(0,0,10)%+b'
lg = "!f() { x=${1-6};\ lg = "!f() { x=${1-6};\
length=$(expr $x + 8);\ length=$(expr $x + 8);\