diff options
Diffstat (limited to '')
| -rw-r--r-- | assets/shell.bash | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/assets/shell.bash b/assets/shell.bash new file mode 100644 index 0000000..d36d1e5 --- /dev/null +++ b/assets/shell.bash @@ -0,0 +1,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 |