README: improve wording an provide a more robust example of use
[config/bash_prompt.git] / styles / iceg
1 #!/bin/bash
2
3 # 'ice graphic' prompt
4
5 PS1="${RESET_CHARSET}"
6 PS1+="${BOLD_CYAN}${MODE_GRAPHIC}"
7 PS1+="${UPPER_LEFT_CORNER}${HORIZ_LINE}${HORIZ_LINE}${MODE_DEFAULT}"
8 PS1+="[ ${BOLD_WHITE}\\t${BOLD_CYAN} ]"
9 PS1+="${MODE_GRAPHIC}${HORIZ_LINE}${MODE_DEFAULT}"
10 PS1+="[ ${BOLD_WHITE}\\d${BOLD_CYAN} ]"
11 PS1+="${MODE_GRAPHIC}${HORIZ_LINE}${MODE_DEFAULT}"
12 PS1+="[${BOLD_WHITE}\\j${BOLD_CYAN}]"
13 PS1+="${MODE_GRAPHIC}${HORIZ_LINE}${MODE_DEFAULT}"
14 PS1+="[${BOLD_WHITE}\#${BOLD_CYAN}]"
15 PS1+="${MODE_GRAPHIC}${HORIZ_LINE}${MODE_DEFAULT}"
16 PS1+="[${BOLD_RED}\${ERR}${BOLD_CYAN}]"
17
18 # VCSH_DIRECTORY is set before a vcsh subshell starts and is valid until the
19 # subshell exits, so it's OK to only check it once and for all when the prompt
20 # is defined.
21 if [[ -n "${VCSH_DIRECTORY-}" ]];
22 then
23   PS1+="${MODE_GRAPHIC}${HORIZ_LINE}${MODE_DEFAULT}[ ${BOLD_YELLOW}VCSH repo: ${BOLD_WHITE}${VCSH_DIRECTORY}${BOLD_CYAN} ]"
24 fi
25
26 if declare -F __git_ps1 >/dev/null;
27 then
28   # Tell which git branch is currently active.
29   PS1+='$(__git_ps1 '
30   PS1+="'"
31   PS1+="${MODE_GRAPHIC_QUOTED}${HORIZ_LINE}${MODE_DEFAULT_QUOTED}[ ${BOLD_YELLOW}"
32   PS1+="Git branch: ${BOLD_WHITE}%s"
33   PS1+="${BOLD_CYAN} ]"
34   PS1+="'"
35   PS1+=')'
36 fi
37
38 PS1+="${MODE_GRAPHIC}${HORIZ_LINE}${HORIZ_LINE}${MODE_DEFAULT}\\n"
39
40 # XXX specifying the color again should not be necessary but bash seems to
41 # forget about the color of the previous prompt line when resizing a terminal
42 # window.
43 PS1+="${BOLD_CYAN}${MODE_GRAPHIC}${LOWER_LEFT_CORNER}${HORIZ_LINE}${HORIZ_LINE}${MODE_DEFAULT}"
44 PS1+="[ ${BOLD_WHITE}\\u${BOLD_CYAN}${WHITE}@${BOLD_WHITE}\\h${BOLD_CYAN}"
45 PS1+=":${BOLD_WHITE}\\w${BOLD_CYAN} ]${RESET}\\$ "