Last active
July 6, 2016 17:30
-
-
Save epylinkn/38d46a7d88a668ce6431def0af4d4128 to your computer and use it in GitHub Desktop.
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
# Change bash prompt emoji by time. | |
time_emoji() { | |
CURRENT_HOUR=`date +"%-H"` | |
if [ "$CURRENT_HOUR" -ge 17 ] && [ "$CURRENT_HOUR" -le 23 ]; then | |
echo $'\xF0\x9F\x8D\xBA' # beer | |
else | |
echo $'\xE2\x9A\xA1' # high voltage / lightning | |
fi | |
} | |
# A cleaner way to color things | |
BLACK="\[$(tput setaf 0)\]" | |
RED="\[$(tput setaf 1)\]" | |
GREEN="\[$(tput setaf 2)\]" | |
LIME_YELLOW="\[$(tput setaf 190)\]" | |
YELLOW="\[$(tput setaf 3)\]" | |
POWDER_BLUE="\[$(tput setaf 153)\]" | |
BLUE="\[$(tput setaf 4)\]" | |
MAGENTA="\[$(tput setaf 5)\]" | |
CYAN="\[$(tput setaf 6)\]" | |
WHITE="\[$(tput setaf 7)\]" | |
BRIGHT="\[$(tput bold)\]" | |
NORMAL="\[$(tput sgr0)\]" | |
BLINK="\[$(tput blink)\]" | |
REVERSE="\[$(tput smso)\]" | |
UNDERLINE="\[$(tput smul)\]" | |
PS1="${BLUE}[\u:${YELLOW}\w${BLUE}]${GREEN}\$(parse_git_branch) \$(time_emoji) ${CYAN}" | |
# Resets output color after command executes | |
trap '[[ -t 1 ]] && tput sgr0' DEBUG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment