1
dot-files/bin/projects-status

27 lines
728 B
Plaintext
Raw Normal View History

2024-07-22 01:01:54 +00:00
#!/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