diff --git a/bin/git-status-recursive b/bin/git-status-recursive new file mode 100755 index 0000000..3ea58fe --- /dev/null +++ b/bin/git-status-recursive @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +CHECK=$(printf '\u2705') +CROSS=$(printf '\u274C') + +startpath=$(pwd) + +function check() { + bash -euo pipefail -c "LANG=C $1" && echo -n "${CHECK}" || echo -n "${CROSS}" +} + +for repo in $(find . -name ".git"); do + cd $(dirname $repo) + reponame=$(short_path) + + clean=$(check 'git status | grep -q "nothing to commit"') + remote=$(check 'git remote -vv | grep -q "push"') + ahead=$(check 'git status | grep -q "is up to date with"') + branch=$(check 'git branch --show-current | grep -qE "(develop|main|master)"') + + echo -e "${reponame}\t${branch}\t${clean}\t${remote}\t${ahead}" + + cd $startpath +done | sort | column -t -N "Repo,B,C,R,U" -s $'\t' + +echo +echo "B = On base-branch, C = Clean, R = Remote set, U = Up to date with remote" diff --git a/bin/git_status_recursive b/bin/git_status_recursive deleted file mode 100755 index 79cbf27..0000000 --- a/bin/git_status_recursive +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -[ -e ~/.bashcolors ] && . ~/.bashcolors - -startpath=$(pwd) - -for repo in $(find . -name ".git"); do - repodir=$(dirname $repo) - reponame=$(basename $repodir) - cd $repodir - LANG=C git status | grep -q "nothing to commit" - state=$? - cd $startpath - echo -n "$reponame: " - [ $state -eq 0 ] && echo -e "${PR_GREEN}Up-2-date${PR_NC}" || echo -e "${PR_BR_RED}Changes available${PR_NC}" -done