(prompt): Check if starship is installed and use it if so.
This commit is contained in:
parent
81a8758904
commit
acdc2d2240
@ -52,7 +52,7 @@ function lastExitCode {
|
|||||||
function hostPrompt() {
|
function hostPrompt() {
|
||||||
local system=$1
|
local system=$1
|
||||||
# echo "\[$(colf "$PROMPT_COLOR")\]░▒▓\[$(colb "$PROMPT_COLOR")\]\[$(colf 7)$(tput bold)\] $system \[$(res)$(colf "$PROMPT_COLOR")$(colb 7)\]▓▒░ \h"
|
# echo "\[$(colf "$PROMPT_COLOR")\]░▒▓\[$(colb "$PROMPT_COLOR")\]\[$(colf 7)$(tput bold)\] $system \[$(res)$(colf "$PROMPT_COLOR")$(colb 7)\]▓▒░ \h"
|
||||||
echo "\[\033[1;34m\] $system \[\033[0;34m\]──\[\033[1;34m\] $myPrettyName\[\033[0;34m\]"
|
echo "$system \[\033[0;34m\]──\[\033[1;34m\] $myPrettyName\[\033[0;34m\]"
|
||||||
}
|
}
|
||||||
function statusPrompt() {
|
function statusPrompt() {
|
||||||
local type=$1
|
local type=$1
|
||||||
@ -78,7 +78,17 @@ function setPrompt() {
|
|||||||
PROMPT="${SYSTEM_PROMPT} ${TYPE_PROMPT}\n${USER_PROMPT}\n${DATE}"
|
PROMPT="${SYSTEM_PROMPT} ${TYPE_PROMPT}\n${USER_PROMPT}\n${DATE}"
|
||||||
|
|
||||||
# PS1="${PROMPT} → \[$(res)\]"
|
# PS1="${PROMPT} → \[$(res)\]"
|
||||||
PS1="\n \[\033[0;34m\]┌─ ${SYSTEM_PROMPT} ── ${DATE} \n ├─ \[\033[1;32m\]\u@\h\[\033[0;34m\] ── \[\033[1;32m\]\w\[\033[0;34m\] \n └> \[\033[1;36m\]\$ \[\033[0m\]"
|
local LINECOL="\[\033[0;34m\]"
|
||||||
|
local COL1="\[\033[1;32m\]"
|
||||||
|
local COL2="\[\033[1;34m\]"
|
||||||
|
local COL3="\[\033[1;36m\]"
|
||||||
|
local CLEAR="\[\033[0;\]"
|
||||||
|
|
||||||
|
local DIV="${LINECOL}──"
|
||||||
|
local LINE1="${LINECOL}\n┌─ ${COL2}${category} ${DIV} ${COL2}${myPrettyName} ${DIV} ${DATE}"
|
||||||
|
local LINE2="${LINECOL}\n├─ ${COL1}\u@\h ${DIV} ${COL1}\w ${CLEAR}"
|
||||||
|
local LINE3="${LINECOL}\n└> \$ \[\033[0m\]"
|
||||||
|
PS1="$LINE1 $LINE2 $LINE3"
|
||||||
}
|
}
|
||||||
|
|
||||||
# example from http://stackoverflow.com/questions/4133904/ps1-line-with-git-current-branch-and-colors
|
# example from http://stackoverflow.com/questions/4133904/ps1-line-with-git-current-branch-and-colors
|
||||||
@ -140,9 +150,17 @@ else
|
|||||||
TYPE=" $myType "
|
TYPE=" $myType "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if command -v 2>&1 >/dev/null; then
|
||||||
|
echo "Found starship, using it"
|
||||||
|
STARSHIP_EXEC="$(which starship)"
|
||||||
|
eval "$($STARSHIP_EXEC init bash)"
|
||||||
|
else
|
||||||
|
echo "No starship, using custom PS1"
|
||||||
setPrompt "${myCategory}" "${myPrettyName}" ${myColor:-6}
|
setPrompt "${myCategory}" "${myPrettyName}" ${myColor:-6}
|
||||||
# color_my_prompt
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# color_my_prompt
|
||||||
# TODO: background colors...
|
# TODO: background colors...
|
||||||
# TODO: private history file for shared accounts
|
# TODO: private history file for shared accounts
|
||||||
# TODO: vim
|
# TODO: vim
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user