Created
February 9, 2016 12:55
-
-
Save onion2k/3462b6effd55472aa192 to your computer and use it in GitHub Desktop.
Bitbar Vagrant Plugin
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 | |
echo "💻 Vagrant" | |
echo "---" | |
echo "Running..." | |
OLDIFS="$IFS" | |
IFS=$'\n' | |
count=`/usr/local/bin/vagrant global-status | tail -n+3 | wc -l` | |
countminus=$((count - 7)) | |
for i in `/usr/local/bin/vagrant global-status | tail -n+3 | head -n${countminus}` | |
do | |
p=(`echo $i | awk '{split($0,p," ")} END {for(n in p){ print p[n] }}'`) | |
case "${p[2]}" in | |
running) | |
color="#008800" | |
;; | |
poweroff) | |
color="#000088" | |
;; | |
aborted) | |
color="#880000" | |
;; | |
halted) | |
color="#888800" | |
;; | |
esac | |
echo ${p[3]} " " ${p[2]} " | color="$color | |
done | |
IFS="$OLDIFS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment