Last active
June 22, 2017 13:33
-
-
Save MichaelAquilina/8d9346a04d67ff2c2c083fb7606bbf2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
if [ -n "$1" ]; then | |
TARGET="$1" | |
else | |
TARGET="." | |
fi | |
GREEN="$(tput setaf 2)" | |
RED="$(tput setaf 1)" | |
RESET="$(tput sgr0)" | |
directories="$(find "$TARGET" -name ".git" -type d)" | |
echo "$directories" | while read -r directory; do | |
NAME="$(dirname "$directory")" | |
pushd "$NAME" > /dev/null | |
STATUS="$(git status --porcelain)" | |
COLOR="$RED" | |
if [[ -z "$STATUS" ]]; then | |
COLOR=$GREEN | |
STATUS="Clean" | |
fi | |
echo "$RESET${NAME:2}: $COLOR$STATUS" | |
popd > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment