aboutsummaryrefslogtreecommitdiffstats
path: root/assets/shell.bash
blob: d36d1e54587ab84e3f178ff2f667b783530bbdca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# User configuration first; this prompt is scoped to Ducky.
[[ -f ~/.bashrc ]] && source ~/.bashrc
_ducky_prompt() {
    local status=$? branch
    branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) || branch=''
    PS1=$'\n\[\e[38;2;196;167;231m\]╭─ '
    PS1+='\[\e[38;2;222;215;232m\]\w'
    _ducky_branch=$branch
    [[ -n $branch ]] && PS1+=' \[\e[38;2;151;213;207m\]⎇ ${_ducky_branch}'
    [[ $status -ne 0 ]] && PS1+=" \[\e[38;2;235;139;156m\]${status}"
    PS1+=$'\n\[\e[38;2;196;167;231m\]╰─❯ \[\e[0m\]'
}
# Keep other prompt hooks, then set Ducky's prompt last.
if declare -p PROMPT_COMMAND 2>/dev/null | grep -q 'declare -a'; then
    PROMPT_COMMAND+=(_ducky_prompt)
else
    PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }_ducky_prompt"
fi