added vagrant machine status to status prompt. show ▶ and

This commit is contained in:
Roman Allenstein 2017-02-21 16:22:27 +01:00
commit 341a9e94fe

View file

@ -202,6 +202,7 @@ prompt_virtualenv() {
# - was there an error # - was there an error
# - am I root # - am I root
# - are there background jobs? # - are there background jobs?
# - is there a vagrant box - if yes, is it running?
prompt_status() { prompt_status() {
local symbols local symbols
symbols=() symbols=()
@ -209,6 +210,14 @@ prompt_status() {
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
if [[ -d ./.vagrant/machines ]]; then
if [[ $(VBoxManage list runningvms | grep -c $(/bin/cat .vagrant/machines/*/*/id)) -gt 0 ]]; then
symbols+="%{%F{green}%}▶"
else
symbols+="%{%F{red}%}◾"
fi
fi
[[ -n "$symbols" ]] && prompt_segment black default "$symbols" [[ -n "$symbols" ]] && prompt_segment black default "$symbols"
} }