Skip to content

Commit 4c45438

Browse files
committed
Battery status addition to .bashprofile and draft of funciton that indicates number of vagrant instances
1 parent 3cc397a commit 4c45438

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

.bash_profile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ function prompt {
2828
local WHITEBOLD="\[\033[1;37m\]"
2929
local RESETCOLOR="\[\e[00m\]"
3030

31-
31+
32+
33+
#function to get battery status
34+
function battery_remaining() {
35+
bp=$(pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';')
36+
echo "$bp"
37+
}
3238

3339
#function to parse git branch
3440
function new_parse_git_branch() {

Vagrant Batt Stat Not Working

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#function to display vagrant instances
2+
function count_vagrant_instance() {
3+
vstat=$(vagrant global_status | grep_running | wc -|)
4+
if [ "$v_stat" == "0"]; then
5+
echo " "
6+
else
7+
echo "vagrant:$vstat:"
8+
}
9+
10+
#function to get battery status
11+
function battery_time() {
12+
if [ "$INTERACTIVETERM" == "-YES-" ]; then
13+
MINREM=`ioreg -l | grep AvgTimeToEmpty | cut -d= -f 2`
14+
if [ "$MINREM" = "" ]; then
15+
# No battery? Maybe a desktop computer
16+
# Do nothing
17+
echo
18+
elif [ $MINREM -gt 60 ]; then
19+
HRREM=$((MINREM / 60))
20+
MREM=`expr $MINREM % 60`
21+
echo Battery: ${tGreen}${tBold}$HRREM hr $MREM min ${tReset} remaining
22+
else
23+
if [ $MINREM -lt 20 ]; then
24+
COLOR=$tRed
25+
else
26+
COLOR=$tGreen
27+
fi
28+
echo "Battery: $COLOR${tBold} $MINREM min ${tReset} remaining"
29+
fi
30+
fi
31+
}

0 commit comments

Comments
 (0)