You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# chezmoi:template:left-delimiter=#{{
|
|
|
|
#{{- /* vim: filetype=bash */ -}}
|
|
|
|
#{{ if not (lookPath "starship") -}}
|
|
|
|
|
|
|
|
#{{ if lookPath "git" -}}
|
|
|
|
_parse_git_status () (
|
|
|
|
if [[ $(git status 2> /dev/null | wc -l) -eq 0 ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $(git status 2> /dev/null | grep -c "working tree clean") -eq 0 ]]; then
|
|
|
|
echo ' ∓'
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
|
|
|
|
_parse_git_branch () (
|
|
|
|
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
|
|
|
|
)
|
|
|
|
#{{- end }}
|
|
|
|
|
|
|
|
_create_prompt() (
|
|
|
|
color_off='\e[0m'
|
|
|
|
green='\e[0;32m'
|
|
|
|
yellow='\e[0;33m'
|
|
|
|
blue='\e[0;34m'
|
|
|
|
purple='\e[0;35m'
|
|
|
|
bblack='\e[1;30m'
|
|
|
|
|
|
|
|
|
|
|
|
RET="\[$green\]"'\u '"\[$blue\]"'$(hostname -s | tr ':A-Z:' ':a-z:') '"\[$green\]\w "
|
|
|
|
#{{ if lookPath "git" -}}
|
|
|
|
RET="$RET\[$bblack\]"'$(_parse_git_branch)'
|
|
|
|
RET="$RET\[$yellow\]"'$(_parse_git_status) '
|
|
|
|
#{{- end }}
|
|
|
|
|
|
|
|
# display date
|
|
|
|
RET="$RET\[$purple\]\D{%F %I:%M%P} "
|
|
|
|
RET="$RET\[$color_off\]\nλ "
|
|
|
|
echo "$RET"
|
|
|
|
)
|
|
|
|
|
|
|
|
PS1=$(_create_prompt)
|
|
|
|
#{{- end }}
|