rcaloras / bash-preexec

⚡ preexec and precmd functions for Bash just like Zsh.
MIT License
862 stars 94 forks source link

Try to better handle external modification to `$PROMPT_COMMAND` #128

Closed gaelicWizard closed 1 year ago

gaelicWizard commented 2 years ago

Some libraries do things like PROMPT_COMMAND="$PROMPT_COMMAND ; _new_addition", that's a space-semicolon-space, and others do PROMPT_COMMAND="_other_thing; $PROMPT_COMMAND". This leads to two consecutive semicolons if both libraries load after bp first sets $PROMPT_COMMAND. It would be counter-productive to try to account for all possibilities, so just swap the install string for a no-op. Then, try to clean up the no-op if it's all that's left.

gaelicWizard commented 2 years ago

I fixed the failing test

rcaloras commented 1 year ago

@akinomyoga thanks for reviewing. Will merge in for you! @gaelicWizard thanks for the original PR! 👍 🍟