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.
40 lines
925 B
Bash
40 lines
925 B
Bash
12 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
4 years ago
|
if [[ -z ${STARSHIP_SESSION_KEY} ]] ; then
|
||
|
return
|
||
|
fi
|
||
|
|
||
4 years ago
|
color_off='\e[0m'
|
||
|
green='\e[0;32m'
|
||
|
yellow='\e[0;33m'
|
||
|
blue='\e[0;34m'
|
||
|
purple='\e[0;35m'
|
||
|
bblack='\e[1;30m'
|
||
6 years ago
|
|
||
12 years ago
|
# display hostname
|
||
4 years ago
|
PS1="\[$green\]"'\u '"\[$blue\]"'$(hostname -s | tr ':A-Z:' ':a-z:') '"\[$green\]\w "
|
||
|
|
||
|
if command -v git &> /dev/null ; then
|
||
3 years ago
|
parse_git_status () (
|
||
4 years ago
|
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
|
||
3 years ago
|
)
|
||
4 years ago
|
|
||
3 years ago
|
parse_git_branch () (
|
||
4 years ago
|
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
|
||
3 years ago
|
)
|
||
4 years ago
|
# display git branch
|
||
|
PS1="$PS1\[$bblack\]"'$(parse_git_branch)'
|
||
|
# display git status
|
||
|
PS1="$PS1\[$yellow\]"'$(parse_git_status) '
|
||
|
fi
|
||
|
|
||
12 years ago
|
# display date
|
||
6 years ago
|
PS1="$PS1\[$purple\]\D{%F %I:%M%P} "
|
||
12 years ago
|
PS1="$PS1\[$color_off\]\nλ "
|