Compare commits
3 Commits
2ccdb553a0
...
6b4ab8e3ff
Author | SHA1 | Date |
---|---|---|
Nick Chambers | 6b4ab8e3ff | |
Nick Chambers | 37cd1750ab | |
Nick Chambers | 312aa84882 |
6
Makefile
6
Makefile
|
@ -1,6 +0,0 @@
|
|||
install:
|
||||
mkdir -p ~/bin/dotlib
|
||||
cp -r dotlib/* ~/bin/dotlib
|
||||
cp -f .bash_profile ~/.bash_profile
|
||||
cp -f .bashrc ~/.bashrc
|
||||
cp -f .hushlogin ~/.hushlogin
|
|
@ -1,26 +1,44 @@
|
|||
prompt-init() {
|
||||
local last_res=$? color=$PS1_color_success
|
||||
PS1="\w "
|
||||
###
|
||||
# Setup and decorate the prompt.
|
||||
###
|
||||
|
||||
if [[ -d .git ]]; then
|
||||
PS1+="$(command git branch --show-current) "
|
||||
fi
|
||||
prompt_symbol=λ
|
||||
prompt_color_fail=(204 80 83)
|
||||
prompt_color_pass=(48 92 161)
|
||||
|
||||
if [[ -v SSH_CLIENT ]]; then
|
||||
PS1+="$PS1_hostname "
|
||||
fi
|
||||
if hash git 2>/dev/null; then
|
||||
prompt_has_git=true
|
||||
fi
|
||||
|
||||
if (( last_res )); then
|
||||
color=$PS1_color_fail
|
||||
fi
|
||||
prompt_color_reset=$(tput sgr0)
|
||||
|
||||
PS1+="\[$color\][$last_res]\[$PS1_color_reset\] $PS1_prompt_sym "
|
||||
symbol-decorate() {
|
||||
local -n prompt_colors=$1
|
||||
local r=${prompt_colors[0]} g=${prompt_colors[1]} b=${prompt_colors[2]}
|
||||
printf '\[\e[38;2;%d;%d;%dm\]%s\[%s\]' "$r" "$g" "$b" "$prompt_symbol" "$(tput sgr0)"
|
||||
}
|
||||
|
||||
PROMPT_COMMAND+=(prompt-init)
|
||||
prompt-decorate() {
|
||||
local res=$? prompt_str
|
||||
|
||||
PS1_prompt_sym=λ
|
||||
PS1_hostname=${HOSTNAME-"$(hostname)"}
|
||||
PS1_color_fail=$(tput setaf 1)
|
||||
PS1_color_success=$(tput setaf 2)
|
||||
PS1_color_reset=$(tput sgr0)
|
||||
# prepend the
|
||||
if [[ -v SSH_CLIENT && -v HOSTNAME ]]; then
|
||||
prompt_str+=$HOSTNAME:
|
||||
fi
|
||||
|
||||
prompt_str+="\w "
|
||||
|
||||
if [[ -v prompt_has_git && -d .git ]]; then
|
||||
prompt_str+="$(command git branch --show-current) "
|
||||
fi
|
||||
|
||||
if (( res )); then
|
||||
prompt_str+=$(symbol-decorate prompt_color_fail)
|
||||
else
|
||||
prompt_str+=$(symbol-decorate prompt_color_pass)
|
||||
fi
|
||||
|
||||
PS1="$prompt_str "
|
||||
}
|
||||
|
||||
PROMPT_COMMAND+=(prompt-decorate)
|
||||
|
|
Loading…
Reference in New Issue