1
0
Files
dotfiles/.local/bin/rgit

31 lines
660 B
Bash
Executable File

#!/bin/bash
bold=$(tput bold)
normal=$(tput sgr0)
red=$(tput setaf 1)
export repos_with_error=()
while read file; do
git -C "$file" rev-parse &> /dev/null
code=$?
if [ $code == 0 ]; then
repo=$(basename "$file")
echo "${bold}${repo}:${normal}"
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)
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