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.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user