Move color constants and PS1 escape sequences from bash-prompt.sh into a new shared rc/03-values.sh, and extract the user@host:dir fragment as LWS_PS1_USER_HOST to eliminate duplication between bash-prompt.sh and git-prompt.sh. Wire up git-prompt to use bash-git-prompt with the shared prompt variables.
17 lines
378 B
Bash
17 lines
378 B
Bash
# Inspired by
|
|
# https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/
|
|
# https://linux.101hacks.com/ps1-examples/prompt-color-using-tput/
|
|
|
|
function get_ps1_prompt()
|
|
{
|
|
echo "${debian_chroot:+($debian_chroot)}${LWS_PS1_USER_HOST}${LWS_PS1_TYPE} "
|
|
}
|
|
|
|
function set_ps1_prompt()
|
|
{
|
|
PS1="$(get_ps1_prompt)"
|
|
export PS1
|
|
}
|
|
|
|
set_ps1_prompt
|