Document opt-in auto-use recipe in README#253
Open
esimkowitz wants to merge 1 commit into
Open
Conversation
Adds a fish snippet that hooks --on-variable PWD to walk up from the current directory for an .nvmrc/.node-version and call nvm use. Mirrors the recipe-style approach used by the upstream nvm-sh README.
Owner
|
This function is a bit too niche. We should provide a minimal boilerplate so people can start experimenting. Also, this seems to bypass nvm use entirely. Lines 196 to 201 in cc70373 |
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.
Summary
Adds a README section showing how users can opt into automatic
nvm useoncd, mirroring the recipe-style approach used in the upstream nvm-sh README.The snippet:
--on-variable PWDhandler so it only runs in interactive shells$PWDto find the nearest.nvmrcor.node-versionnvm use --silentwhen a file is foundcdbetween subdirectories of the same projectAlternative to #252
This is a documentation-only alternative to #252, which added a built-in
nvm_auto_usevariable. Keeping the behavior as a README recipe avoids growing the plugin's surface area and lets users tweak the function for their own preferences (e.g., falling back to a default version, integrating with other tools). I'll close #252 in favor of this approach.Test plan
cd-ing into a directory with a.nvmrcfires the hookcds within the same project are no-ops (cached file path)fish -c '...')