-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap chruby_auto to ease augmentation (issue #227) #355
base: master
Are you sure you want to change the base?
Conversation
It's been so long that a lot of this has seeped out of my head by now, but I was just re-reading my comment at #227 (comment) and thinking about the difference between calling chruby_auto and [[ "$BASH_COMMAND" != "$PROMPT_COMMAND" ]] && chruby_auto As I understand it, this change would repeatedly call |
@aprescott In my proposed change, the check of
I believe the check is most appropriate within the trap rather than in the wrapper function. If the check were moved to within the wrapper, that could easily lead to issues when a user tried to override the wrapper. |
+1 for this PR. I set my own Are there any objections to this? (I note it's over a year old) |
How about providing a common |
Isn’t that exactly |
Unfortunately Bash (in particular Bash 3 which macOS still ships) does not have |
Then I’m once again advertising for https://github.com/rcaloras/bash-preexec, which saves us from manually fiddling with If users are still using |
For example, what if we have function chruby_hook() {
chpython_auto
}
function chpython_hook() {
chnode_auto
}
function chnode_hook() {
chperl_auto
} with the bash-preexec solution preexec_functions+=(chruby_auto chpython_auto chnode_auto chperl_auto) In addition, what about #399? Hence, my proposal: if preexec exist, use it (Bash or Zsh); fall back to |
How did I not see this sooner? bash-preexec looks like it would solve our problems and allow for better interoperability with other tools that wish to hook |
Presumably you'd also check to see if Personally I'm not sure the added cost of vendoring a dependency is a net gain over the proposal in this PR, or the alternate proposal in #355 (comment). Incorporating |
I’m recommending detecting |
Then to me, that change seems like it would be independent of this PR. Personally I'd prefer not to have to install a separate add-on in order to be able to more easily control when |
This change implements the proposal in #227 and likely addresses #346 as well. All tests pass on OS X 10.10.
It occurs to me that this is somewhat of a breaking change for zsh users who expect chruby_auto to be added directly to preexec_functions (for example, the code in this comment from issue #191).