Skip to content

Instantly share code, notes, and snippets.

@onion2k
Created February 9, 2016 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onion2k/3462b6effd55472aa192 to your computer and use it in GitHub Desktop.
Save onion2k/3462b6effd55472aa192 to your computer and use it in GitHub Desktop.
Bitbar Vagrant Plugin
#!/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