zshrc: neue Tools im Cheatsheet; gitcheck: lazygit-Integration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rene 2026-03-27 13:08:44 +01:00
parent 5a9174d898
commit c4d9eeac6f
2 changed files with 26 additions and 0 deletions

View file

@ -85,6 +85,7 @@ unset IFS
total=0
dirty=0
clean=0
dirty_repos=()
for gitdir in "${sorted_gitdirs[@]}"; do
repo_dir="${gitdir%/.git}"
@ -113,6 +114,7 @@ for gitdir in "${sorted_gitdirs[@]}"; do
if $is_dirty; then
((dirty++))
dirty_repos+=("$repo_dir")
else
((clean++))
$SHOW_ALL || continue
@ -155,5 +157,19 @@ if ((dirty == 0)); then
exit 0
else
echo "$dirty Repository(s) mit offenen Änderungen. ⚠️"
# lazygit anbieten wenn interaktiv und verfügbar
if [ -t 1 ] && command -v lazygit &>/dev/null && ((dirty > 0)); then
echo
for i in "${!dirty_repos[@]}"; do
printf " %s[%d]%s %s\n" "$C_CYAN" "$((i+1))" "$C_RESET" "${dirty_repos[$i]##*/}"
done
printf "\n Repo in lazygit öffnen? (1-%d / Enter zum Überspringen): " "${#dirty_repos[@]}"
read -r choice
if [[ "$choice" =~ ^[0-9]+$ ]] && ((choice >= 1 && choice <= ${#dirty_repos[@]})); then
lazygit -p "${dirty_repos[$((choice-1))]}"
fi
fi
exit 1
fi