Created by: ismith
bash-preexec "provides preexec and precmd hook functions for Bash in the style of Zsh".
Unfortunately, it interferes with trap DEBUG
and PROMPT_COMMAND
behavior used by LP_ENABLE_ERROR
and LP_ENABLE_RUNTIME
.
Fortunately, since liquidprompt already supports add-zsh-hook behavior, we can use those hooks as guides to where we should add hooks for bash-preexec.
These hooks get set if __bp_imported
is "defined"; this is set by
bash-preexec.
Tests:
Cases:
- with LP_ENABLE_ERROR=1, running
false
should put a1
at the end of the prompt - with LP_ENABLE_RUNTIME=1 and LP_RUNTIME_THRESHOLD=2,
sleep 3
should put a 3 at the end of the prompt - Optionally, you can run both of the above at once:
sleep 3 && false
-
prompt_off
andprompt_on
still work
Scenarios:
- with bash-preexec installed, and enabled in
~/.bashrc
:source ~/.bash-preexec.sh
- with bash-preexec installed, but the
source
line commented out (checking that this PR does not break existing behavior)