提交 246d698e 编写于 作者: E Erwin Jansen 提交者: Toan Nguyen

Allow overriding of prompt addition (#24)

Some environments have stringent security features that do not allow the
execution of functions inside `$PROMPT_COMMAND`, breaking every individual
theme.

We now allow the overriding of the prompt setter command to workaround
this.
上级 ee619e26
......@@ -499,6 +499,12 @@ function aws_profile {
fi
}
# Returns true if $1 is a shell function.
fn_exists() {
type $1 | grep -q 'shell function'
}
function safe_append_prompt_command {
local prompt_re
......@@ -511,6 +517,12 @@ function safe_append_prompt_command {
prompt_re="\<${1}\>"
fi
# See if we need to use the overriden version
if [[ $(fn_exists append_prompt_command_override) ]]; then
append_prompt_command_override $1
return
fi
if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then
return
elif [[ -z ${PROMPT_COMMAND} ]]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册