From 2561a9ce85c0f40894a2393b0e008e4a8ef048a2 Mon Sep 17 00:00:00 2001 From: antoine Date: Mon, 24 Jun 2024 10:03:17 -1000 Subject: [PATCH] Managing git pull mesages --- gitpuller.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gitpuller.sh b/gitpuller.sh index 9e020b4..43b897d 100644 --- a/gitpuller.sh +++ b/gitpuller.sh @@ -32,15 +32,26 @@ PROGRESS_BAR_DISPLAY_COMPL=1 puller() { SECONDS=0 i=1 + reporting=false + report=$'============================\nPulling generated messages :\n============================\n' for repo in ${REPOS[@]}; do + run_error="" echo $repo $i - git -C $repo/.. pull > /dev/null + run_error=$(git -C $repo/.. pull 2>&1 > /dev/null) + if [[ $run_error ]]; then + reporting=true + report=$report$"* On $repo :"$'\n'"$run_error"$'\n' + fi ((i++)) done duration=$SECONDS ((i--)) echo "[Finished] - Pulled $i/$PULL_ITER repositories in $((duration / 60)):$((duration % 60))" + + if [ "$reporting" = true ]; then + echo "$report" + fi } draw_progressbar() { @@ -95,7 +106,7 @@ parse_output() { "$iteration" \ "$PULL_ITER" \ "$info" - elif [[ "$line" =~ Finished ]]; then + else printf >&2 "\033[0K\r" printf "%s\n" "$line" fi