Use zsh chpwd hooks to look for .phpbrewrc instead of trap call#985
Merged
c9s merged 1 commit intoOct 28, 2018
Merged
Conversation
The original approach was looking for .phpbrewrc after EVERY command, when in reality we only need to look for it when the current directory changes. `trap` may be needed in bash, but zsh includes a hook mechanism for various shell events, including changing directory. This commit makes use of that hook mechanism to look for .phpbrewrc ONLY when the current directory changes. This affects only zsh users. You can check http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions for more info on zsh hooks.
514ff86 to
14521b3
Compare
1 similar comment
2e394ad to
14521b3
Compare
Member
|
Looks good to me |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
PHPBREW_RC_ENABLEis set, we look for.phpbrewrcafter EVERY command, even though we only need to look for it when the current directory changes. Thattrapcall may be needed in bash, but zsh provides a hook mechanism for various shell events, including changing directory.This PR makes use of that hook mechanism to look for
.phpbrewrcONLY when the current directory changes. This affects only zsh users.Pros of this approach:
.phpbrewrcONLY when changing directories, instead of after EVERY command.cdhook.Cons of this approach:
You can check http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions for more info on zsh hooks.