File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,13 @@ function prompt {
28
28
local WHITEBOLD=" \[\033[1;37m\]"
29
29
local RESETCOLOR=" \[\e[00m\]"
30
30
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
+ }
32
38
33
39
# function to parse git branch
34
40
function new_parse_git_branch() {
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments