Wrap chruby_auto to ease augmentation (issue #227) - #355
Conversation
aprescott
commented
Jan 7, 2016
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_autoand [[ "$BASH_COMMAND"!="$PROMPT_COMMAND" ]] && chruby_autoAs I understand it, this change would repeatedly call |
ilikepi
commented
Jan 7, 2016
@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. |
HaleTom
commented
Apr 23, 2017
+1 for this PR. I set my own Are there any objections to this? (I note it's over a year old) |
postmodern
commented
Jan 31, 2021
How about providing a common |
FranklinYu
commented
Jan 19, 2022
Isn’t that exactly |
postmodern
commented
Jan 19, 2022
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 |
FranklinYu
commented
Jan 19, 2022
For example, what if we have functionchruby_hook() {
chpython_auto
}
functionchpython_hook() {
chnode_auto
}
functionchnode_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 |
postmodern
commented
Jan 19, 2022
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 |
ilikepi
commented
Jan 19, 2022
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 |
FranklinYu
commented
Jan 19, 2022
I’m recommending detecting |
ilikepi
commented
Jan 21, 2022
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).