Skip to content

Commit

Permalink
fix(bash): bash-preexec detection and implementation (starship#2091)
Browse files Browse the repository at this point in the history
* Fix bash-preexec detection and implementation

* Add detection for other arrays
  • Loading branch information
chipbuster authored Jan 7, 2021
1 parent 435ec17 commit 55c3caf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/init/starship.bash
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ starship_precmd() {

# If the user appears to be using https://github.com/rcaloras/bash-preexec,
# then hook our functions into their framework.
if [[ $preexec_functions ]]; then
preexec_functions+=('starship_preexec "$_"')
if [[ "${__bp_imported:-}" == "defined" || $preexec_functions || $precmd_functions ]]; then
# bash-preexec needs a single function--wrap the args into a closure and pass
starship_preexec_all(){ starship_preexec "$_"; }
preexec_functions+=(starship_preexec_all)
precmd_functions+=(starship_precmd)
else
# We want to avoid destroying an existing DEBUG hook. If we detect one, create
Expand Down

0 comments on commit 55c3caf

Please sign in to comment.