feat(rc): Add preference for starship prompt over powerline-go
This commit is contained in:
+8
-6
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
# Customize the prompt
|
# Customize the prompt
|
||||||
|
|
||||||
MY_PROMPTS="powerline-go starship"
|
# Indicate your preference order for prompt tools
|
||||||
|
# The first one found available will be used
|
||||||
|
MY_PROMPTS="starship powerline-go"
|
||||||
|
|
||||||
for prompt in $MY_PROMPTS; do
|
for prompt in $MY_PROMPTS; do
|
||||||
if (command -v "$prompt" &>/dev/null); then
|
if (command -v "$prompt" &>/dev/null); then
|
||||||
@@ -11,26 +13,26 @@ for prompt in $MY_PROMPTS; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
case "$USE_PROMPT" in
|
case "${USE_PROMPT}" in
|
||||||
|
|
||||||
|
# https://starship.rs/
|
||||||
"starship")
|
"starship")
|
||||||
if (command -v starship &>/dev/null); then
|
if (command -v starship &>/dev/null); then
|
||||||
# echo "Using $USE_PROMPT prompt"
|
|
||||||
eval "$(starship init bash)"
|
eval "$(starship init bash)"
|
||||||
else
|
else
|
||||||
echo "$USE_PROMPT command not found"
|
echo "${USE_PROMPT} command not found"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
# https://github.com/justjanne/powerline-go
|
||||||
"powerline-go")
|
"powerline-go")
|
||||||
if (command -v powerline-go &>/dev/null); then
|
if (command -v powerline-go &>/dev/null); then
|
||||||
# echo "Using $USE_PROMPT prompt"
|
|
||||||
function _update_ps1() {
|
function _update_ps1() {
|
||||||
PS1=$(powerline-go -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace,termtitle" -newline)
|
PS1=$(powerline-go -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace,termtitle" -newline)
|
||||||
}
|
}
|
||||||
if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_ps1"; fi
|
if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_ps1"; fi
|
||||||
else
|
else
|
||||||
echo "$USE_PROMPT command not found"
|
echo "${USE_PROMPT} command not found"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user