1
dot-files/bin/projects-status

27 lines
728 B
Bash
Executable File

#!/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