diff --git a/bin/projects-status b/bin/projects-status new file mode 100755 index 0000000..358fd57 --- /dev/null +++ b/bin/projects-status @@ -0,0 +1,26 @@ +#!/bin/bash + +################################################################################ +# +# projects-status +# Reports whether any git repositories in ~/Projects are in a dirty state +# +################################################################################ + +echo "Projects with changes in ${HOME}/Projects/:" +for DIR in ${HOME}/Projects/*/; do + + # Make sure this is a git repository + if ! [ -d "${DIR/.git}" ]; then + continue + fi + + # Report whether or not the repository is in a dirty state + CHANGED=$(git -C "${DIR}" status --porcelain) + if ! [ -z "${CHANGED}" ]; then + PROJECT_NAME="${DIR%/}" + PROJECT_NAME="${PROJECT_NAME##*/}" + echo "${PROJECT_NAME}" + fi + +done