29 lines
793 B
Bash
Executable File
29 lines
793 B
Bash
Executable File
#!/bin/bash
|
|
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
CONFIG_FILE="$ENV_DIR/.systems"
|
|
|
|
source $ENV_DIR/bin/messages
|
|
|
|
importantmsg "[dev-env]: $ENV_DIR"
|
|
|
|
# Iterate through all lines in .systems configuration
|
|
while IFS=' ' read -r IDENTIFIER DIRECTORY GIT; do
|
|
# Skip comments and emtpy lines
|
|
if [[ "$IDENTIFIER" =~ ^#.* ]] || [ -z "$IDENTIFIER" ]; then
|
|
continue
|
|
fi
|
|
|
|
SYSTEM_PATH=$(realpath "$ENV_DIR/systems/$DIRECTORY")
|
|
BRANCH=$(git -C "$SYSTEM_PATH" rev-parse --abbrev-ref HEAD)
|
|
if [ -n "$(git -C "$SYSTEM_PATH" status --porcelain)" ]; then
|
|
CHANGES="(X)"
|
|
else
|
|
CHANGES=""
|
|
fi
|
|
|
|
infomsg "[$IDENTIFIER]: ./systems/$DIRECTORY ${ANSI_OPEN}91m($BRANCH)${ANSI_OPEN}93m $CHANGES${ANSI_OPEN}0m"
|
|
|
|
done < "$CONFIG_FILE"
|
|
|
|
echo ""
|
|
docker ps |