Last active
April 4, 2019 13:46
-
-
Save dacostafilipe/a1ac94d5b846ddc8f1e50312da751ac0 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 "--SSH" | |
echo "----Web | bash='cd ${SOURCE}; ddev ssh'" | |
echo "----Database | bash='cd ${SOURCE}; ddev ssh --service db'" | |
echo "-----" | |
echo "--Restart | bash='ddev restart ${NAME}'" | |
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