1

Add projects-status script

This commit is contained in:
Jessie Hildebrandt 2024-07-21 21:01:54 -04:00
parent 96e747d087
commit 1c9aed3d3c

26
bin/projects-status Executable file
View File

@ -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