Created
July 31, 2018 17:33
-
-
Save dylnuge/189e39c07c802753a9200869294b9978 to your computer and use it in GitHub Desktop.
Extension to the Oh My Zsh Agnoster theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt_timestamp() { | |
# Use timestamp to alert user that it's getting late. Time between 7 AM and | |
# 8 PM is shown in green. Time between 8 PM and 12 AM is shown in yellow. Time | |
# after 12 AM (but before 7 AM next morning) is shown in red. | |
currTime=`date +%k%m` | |
if [ $currTime -ge 700 -a $currTime -lt 2000 ]; then | |
prompt_segment default green '[%t]' | |
# Midnight is 0000, so can't compare with it easily | |
elif [ $currTime -ge 2000 -a $currTime -le 2359 ]; then | |
prompt_segment default yellow '[%t]' | |
else | |
prompt_segment default red '[%t]' | |
fi | |
} | |
build_rprompt() { | |
RETVAL=$? | |
prompt_timestamp | |
} | |
RPROMPT='%{%f%b%k%}$(build_rprompt) ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment