From 474725ff875e1cd022226710a6807d7f1e45f171 Mon Sep 17 00:00:00 2001 From: mrjk Date: Sat, 15 Apr 2023 12:30:03 -0400 Subject: [PATCH] add: support for PS1_*FIX --- lib/idmgr_mod_ps1.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/idmgr_mod_ps1.sh b/lib/idmgr_mod_ps1.sh index 8a309f7..d68914e 100644 --- a/lib/idmgr_mod_ps1.sh +++ b/lib/idmgr_mod_ps1.sh @@ -37,17 +37,38 @@ idm_ps1__help () } idm_ps1__enable () +{ + + # Detect is PS1_*FIX vars exists + if [ "${PS1_PREFIX+x}" == x ]; then + >&2 echo "Suffixx: ${PS1_PREFIX+x}" + idm_ps1__enable_suffix $@ + else + >&2 echo "Classic: ${PS1_PREFIX+x}" + idm_ps1__enable_raw $@ + fi + +} + +idm_ps1__enable_raw () { local id=${1} id="\[\033[0;34m\]($id)\[\033[00m\]" echo "export PS1=\"$id \${IDM_SHELL_PS1}\"" # Notes about colors: - # \033]00m\] # for shell - # \[\033]01;31m\] for ps1 + # \033]00m # for shell + # \[\033]01;31m\] # for ps1 } +idm_ps1__enable_suffix () +{ + local id=${1} + id="\033[0;34m($id)\033[00m" + echo "export PS1_PREFIX=\"$id $PS1_PREFIX\"" +} + idm_ps1__disable () { echo "export PS1=\"\${IDM_SHELL_PS1}\""