rename function, fix promptcommandmunge

This commit is contained in:
Jakobus Schürz 2020-11-28 18:00:17 +01:00
parent 420cb4663c
commit d8ca48066b
2 changed files with 7 additions and 7 deletions

View file

@ -170,7 +170,7 @@ EOF
# source loading workaround for x2go to forward local etoken to remote machine with forwardagent # source loading workaround for x2go to forward local etoken to remote machine with forwardagent
. "${MYSHELLCONFIG_BASE}/myshell_load_x2go_tokenforward" . "${MYSHELLCONFIG_BASE}/myshell_load_x2go_tokenforward"
promptcommandmunge "_prompt_command" promptcommandmunge "_tmux_hook"
promptcommandmunge "_umask_hook" promptcommandmunge "_umask_hook"
which direnv >/dev/null && eval "$(direnv hook bash)" which direnv >/dev/null && eval "$(direnv hook bash)"

View file

@ -8,21 +8,21 @@ export TMUX_SESSION_DIRS SETPROXY_CREDS_DIRS KERBEROS_CONFIG_DIRS
promptcommandmunge () { promptcommandmunge () {
ENTRY ENTRY
case ":${PROMPT_COMMAND}:" in case ";${PROMPT_COMMAND};" in
*:"$1":*) "*;$1;*")
;; ;;
*) *)
if [ "$2" = "after" ] ; then if [ "$2" = "after" ] ; then
PROMPT_COMMAND=$PROMPT_COMMAND:$1 PROMPT_COMMAND="${PROMPT_COMMAND};$1"
else else
PROMPT_COMMAND=$1:$PROMPT_COMMAND PROMPT_COMMAND="$1;${PROMPT_COMMAND}"
fi fi
esac esac
EXIT EXIT
} }
## this function updates in combination with PROMPT_COMMAND the shell-environment-variables in tmus-sessions, ## this function updates in combination with PROMPT_COMMAND the shell-environment-variables in tmus-sessions,
# every time prompt is called. It does it only, when called from tmux (Environment TMUX is set) # every time prompt is called. It does it only, when called from tmux (Environment TMUX is set)
function _prompt_command() { function _tmux_hook() {
# [ -z "${TMUX+x}" ] || eval "$(tmux show-environment -s)" # [ -z "${TMUX+x}" ] || eval "$(tmux show-environment -s)"
if [ -n "${TMUX}" ]; then if [ -n "${TMUX}" ]; then
@ -32,7 +32,7 @@ function _prompt_command() {
} }
# Append `;` if PROMPT_COMMAND is not empty # Append `;` if PROMPT_COMMAND is not empty
#PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND;}_prompt_command" #PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND;}_tmux_hook"
# To make the code more reliable on detecting the default umask # To make the code more reliable on detecting the default umask