Created
October 6, 2015 16:55
-
-
Save krmcbride/563eb0201ac29ac8070b to your computer and use it in GitHub Desktop.
A custom bash-it theme based on the emperor theme that includes docker information
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
#!/usr/bin/env bash | |
SCM_THEME_PROMPT_DIRTY=" ${red}✗" | |
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" | |
SCM_THEME_PROMPT_PREFIX=" |" | |
SCM_THEME_PROMPT_SUFFIX="${green}|" | |
GIT_THEME_PROMPT_DIRTY=" ${red}✗" | |
GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" | |
GIT_THEME_PROMPT_PREFIX=" ${green}|" | |
GIT_THEME_PROMPT_SUFFIX="${green}|" | |
RVM_THEME_PROMPT_PREFIX="|" | |
RVM_THEME_PROMPT_SUFFIX="|" | |
function get_hour_color { | |
hour_color=$red | |
min=$(date +%M) | |
if [ "$min" -lt "15" ]; then | |
hour_color=$green | |
elif [ "$min" -lt "30" ]; then | |
hour_color=$white | |
elif [ "$min" -lt "45" ]; then | |
hour_color=$yellow | |
else | |
hour_color=$red | |
fi | |
echo "$hour_color" | |
} | |
function docker_machine_info { | |
if [ $DOCKER_MACHINE_NAME ]; then | |
case "$DOCKER_MACHINE_NAME" in | |
'default') color=$cyan ;; | |
*) color=$red ;; | |
esac | |
if [[ $DOCKER_HOST == *":3376" ]]; then | |
echo " ${color}🐳 |$DOCKER_MACHINE_NAME (swarm)|" | |
else | |
echo " ${color}🐳 |$DOCKER_MACHINE_NAME|" | |
fi | |
fi | |
} | |
function prompt_command() { | |
PS1="\n$(get_hour_color)$(date +%H) ${purple}\h ${reset_color} ${bold_black}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info)$(docker_machine_info) ${green}→${reset_color} " | |
} | |
PROMPT_COMMAND=prompt_command; |
Author
krmcbride
commented
Oct 6, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment