add uptime

This commit is contained in:
2023-05-04 15:44:48 -04:00
parent 3b465c8a76
commit 9aa4cacc69
+9
View File
@@ -3,6 +3,7 @@
# Charles Danesi, 2022. # Charles Danesi, 2022.
# parts taken from https://gist.github.com/loudambiance/a41b42a4295bce6e7304 # parts taken from https://gist.github.com/loudambiance/a41b42a4295bce6e7304
# TODO add uptime to prompt
# TODO git merge status # TODO git merge status
# TODO git isLocalOnly to check if there are remotes or if this is only a local repo) # TODO git isLocalOnly to check if there are remotes or if this is only a local repo)
# TODO number of pushes pending # TODO number of pushes pending
@@ -75,6 +76,7 @@ clrDefaultBrackets=$clrBrackets # default color
clrGitBranch=$LIGHTGREEN clrGitBranch=$LIGHTGREEN
clrGitHash=$CDNET1 clrGitHash=$CDNET1
clrCmdRunTime=$CYAN clrCmdRunTime=$CYAN
clrUptime=$CYAN
GITBG1="\[\e[47m\]" GITBG1="\[\e[47m\]"
GITBG2="\[\e[100m\]" GITBG2="\[\e[100m\]"
@@ -95,6 +97,7 @@ fShowUserHost=1 # Show user and host #### NOTE: CURRENTLY UNUSED ####
fWorkingDirectory=1 # Show current directory fWorkingDirectory=1 # Show current directory
fPathShortening=1 # Enable directory shortening (configurable) fPathShortening=1 # Enable directory shortening (configurable)
fLastCmdRunTime=1 # Display last cmd wall time fLastCmdRunTime=1 # Display last cmd wall time
fShowUptime=1 # Display system uptime on the prompt
fShowTaskCount=1 # Show task count from todo.txt, if installed fShowTaskCount=1 # Show task count from todo.txt, if installed
@@ -191,6 +194,12 @@ function promptcmd() {
PS1="${PS1}${clrBrackets}[${clrClock}\t${clrBrackets}]${clrLines}\342\224\200" PS1="${PS1}${clrBrackets}[${clrClock}\t${clrBrackets}]${clrLines}\342\224\200"
fi fi
# system uptime
if [ $fShowUptime -eq 1 ] ; then
sysUptime=$(uptime| cut -d "," -f 1-2 | cut -d " " -f 4-5,7)
PS1="${PS1}${clrBrackets}[${clrUptime}${sysUptime}${clrBrackets}]${clrLines}\342\224\200"
fi
# detached screen sessions # detached screen sessions
if [ $fScreenTracker -eq 1 ] ; then if [ $fScreenTracker -eq 1 ] ; then
hTMUX=0 hTMUX=0