Avoid double semicolon in the PROMPT_COMMAND
The direnv bash hook already add a semicolon to the PROMPT_COMMAND and this plugin will add another one if direnv is installed. This commit will check if the PROMPT_COMMAND ends with semicolon to avoid have double ones.pull/1222/head
parent
812a5d411b
commit
f847371447
|
|
@ -5,7 +5,7 @@ about-plugin 'osx-specific functions'
|
||||||
if [ $(uname) = "Darwin" ]; then
|
if [ $(uname) = "Darwin" ]; then
|
||||||
if type update_terminal_cwd > /dev/null 2>&1 ; then
|
if type update_terminal_cwd > /dev/null 2>&1 ; then
|
||||||
if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then
|
if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then
|
||||||
PROMPT_COMMAND="$PROMPT_COMMAND;update_terminal_cwd"
|
PROMPT_COMMAND="${PROMPT_COMMAND%;};update_terminal_cwd"
|
||||||
declared="$(declare -p PROMPT_COMMAND)"
|
declared="$(declare -p PROMPT_COMMAND)"
|
||||||
[[ "$declared" =~ \ -[aAilrtu]*x[aAilrtu]*\ ]] 2>/dev/null
|
[[ "$declared" =~ \ -[aAilrtu]*x[aAilrtu]*\ ]] 2>/dev/null
|
||||||
[[ $? -eq 0 ]] && export PROMPT_COMMAND
|
[[ $? -eq 0 ]] && export PROMPT_COMMAND
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue