-
-
Save KaffDaddy/d465769af67ca62238d64b9a243bf431 to your computer and use it in GitHub Desktop.
bitbar Plugin for ddev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Display status of DDEV configs | |
# | |
# | |
# <bitbar.title>DDEV List</bitbar.title> | |
# <bitbar.version>v1.0</bitbar.version> | |
# <bitbar.author>DA COSTA Filipe</bitbar.author> | |
# | |
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" | |
echo "DDEV" | |
echo "---" | |
LIST=$(ddev list | sed '/http:/!d') | |
while read -r line; do | |
NAME=$(echo $line | cut -f1 -d" ") | |
TYPE=$(echo $line | cut -f2 -d" ") | |
SOURCE=$(echo $line | cut -f3 -d" ") | |
URI=$(echo $line | cut -f4 -d" ") | |
STATUS=$(echo $line | cut -f5 -d" ") | |
if [ $STATUS = "running" ]; then | |
COLOR='green' | |
else | |
COLOR='red' | |
fi | |
echo "${NAME} | color=${COLOR}" | |
if [ $STATUS = "running" ]; then | |
echo "--${URI} | href='${URI}'" | |
echo "--Stop | bash='ddev stop ${NAME}'" | |
else | |
echo "--Start | bash='ddev start ${NAME}'" | |
fi | |
echo "---" | |
done <<< "$LIST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment