support bash-preexec
parent
5df98aeac9
commit
5ff7df1607
|
|
@ -499,9 +499,25 @@ function aws_profile {
|
|||
fi
|
||||
}
|
||||
|
||||
function __check_precmd_conflict() {
|
||||
local f
|
||||
for f in "${precmd_functions[@]}"; do
|
||||
if [[ "${f}" == "${1}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function safe_append_prompt_command {
|
||||
local prompt_re
|
||||
|
||||
if [ "${__bp_imported}" == "defined" ]; then
|
||||
# We are using bash-preexec
|
||||
if ! __check_precmd_conflict "${1}" ; then
|
||||
precmd_functions+=("${1}")
|
||||
fi
|
||||
else
|
||||
# Set OS dependent exact match regular expression
|
||||
if [[ ${OSTYPE} == darwin* ]]; then
|
||||
# macOS
|
||||
|
|
@ -518,4 +534,5 @@ function safe_append_prompt_command {
|
|||
else
|
||||
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue