From 65615e0fe904bef041a1539549d16c6474abf0ae Mon Sep 17 00:00:00 2001 From: Karsten Hachmeister Date: Mon, 3 Jul 2023 14:19:40 +0200 Subject: [PATCH] add error overview to rgit util --- .local/bin/rgit | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.local/bin/rgit b/.local/bin/rgit index 92fcd8b..acf5bd2 100755 --- a/.local/bin/rgit +++ b/.local/bin/rgit @@ -2,8 +2,11 @@ bold=$(tput bold) normal=$(tput sgr0) +red=$(tput setaf 1) -find -mindepth 1 -maxdepth 1 -type d | sort | while read file; do +export repos_with_error=() + +while read file; do git -C "$file" rev-parse &> /dev/null code=$? @@ -13,7 +16,16 @@ find -mindepth 1 -maxdepth 1 -type d | sort | while read file; do if (( "$#" > 0 )); then git -C "$file" "$@" + if [ $? != 0 ]; then + repos_with_error+=("$repo") + fi fi fi +done < <(find -mindepth 1 -maxdepth 1 -type d | sort) -done +if [ ${#repos_with_error[@]} != 0 ]; then + echo -e "\n${bold}${red}Fehler in folgenden Verzeichnissen:${normal}" + for repo in "${repos_with_error[@]}"; do + echo " - ${red}${repo}${normal}" + done +fi \ No newline at end of file