add: support for PS1_*FIX

This commit is contained in:
mrjk 2023-04-15 12:30:03 -04:00
parent 1afe28bcde
commit 474725ff87

View File

@ -37,17 +37,38 @@ idm_ps1__help ()
} }
idm_ps1__enable () 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} local id=${1}
id="\[\033[0;34m\]($id)\[\033[00m\]" id="\[\033[0;34m\]($id)\[\033[00m\]"
echo "export PS1=\"$id \${IDM_SHELL_PS1}\"" echo "export PS1=\"$id \${IDM_SHELL_PS1}\""
# Notes about colors: # Notes about colors:
# \033]00m\] # for shell # \033]00m # for shell
# \[\033]01;31m\] for ps1 # \[\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 () idm_ps1__disable ()
{ {
echo "export PS1=\"\${IDM_SHELL_PS1}\"" echo "export PS1=\"\${IDM_SHELL_PS1}\""