-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
add nvm script for use by other shells #582
Conversation
#!/bin/bash | ||
|
||
# For non bash-shells (fish, etc) | ||
# add <prefix>/nvm/bin and <prefix>/nvm/current/bin to PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be part of the install script as well?
|
||
Where nvm is installed at `~/.nvm` | ||
|
||
set -x fish_user_paths $PATH $NVM_DIR/.nvm/current/bin $NVM_DIR/.nvm/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$NVM_DIR
already contains .nvm
- you want $NVM_DIR/current/bin $NVM_DIR/bin
Also, please note, I'll soon be switching the default behavior of nvm
to NOT create the "current" symlink.
|
How is the current symlink problematic? Does it interfere with something? I implemented that as unobtrusively as I could think of the first time around (#447), and I don't see how it can be an issue. Also, considering the relative ease at which nvm can be made to support ALL shells, this seems like a straight forward thing to implement. If at some point it actually presents a real problem, I can see the justification in removing it, but not just for the sake of what "might be". |
If in one shell I have The correct answer is "neither" - the concept of a "current" version only exists in a single shell, and is totally invalid beyond that, including in the filesystem. |
When you mean one shell, and another shell, I assume you mean instances of each shells as opposed to I thought quite awhile before settling on the name While the implementation is restricted to not include the scenario you describe, I'm guessing you're still addressing a very large amount of use-cases (certainly mine) out there. If there's a better way of implementing it then surely you can consider it later rather than abandoning this one simply because it doesn't cover all use-cases ? |
The original use case, as I recall, for the current symlink was to support IDEs. However, as it's since become clear to me, The naming aside, the entire concept of the symlink doesn't make sense based on this interpretation of what However, I really like the idea of your approach as a way to begin solving issues with other shells (like |
What about folks who are using |
@nvcexploder You can do any regression testing you need within a shell environment. All |
Original use-case was #430 which is also mine, but basically it was just to support fish-shell. #467 had an IDE use-case but the implementation that ended up being used was mine. Both our use-cases were solved by this. Having a preconceived idea of what
I find this statement surprising as while Speaking of which, one issue I've found with But yes, the portability to other shells is far easier to deal with if I could see an API such as:
Then other shells would just need a wrapper per shell to deal with setting the path. |
"default" is just an alias. Saying that "x" is default doesn't mean in any way that a given shell is running "x", just that it /starts/ as "x". I would absolutely be in favor of a PR that adds Let's get that in first, and then it might be much simpler to solve the fish/other shell/IDE issue with that. Thoughts? |
Yeah, that was really all the functionality I was looking for fish since it solved my whole use-case.
I can do that |
actually, going to reopen this and ask still that you consider this immediately as either way, this script would be useful both with the current symlink, and after |
@@ -0,0 +1,8 @@ | |||
#!/bin/bash | |||
|
|||
export NVM_SYMLINK_CURRENT=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must this env var be forced to true, for this script to work, rather than just using the environment setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but the script uses about 90% of it's value without it. Basically you'd be forced to add something to your environmental settings which can just as easily be done here saving the work.
Here's nvm which: #583 |
closing for now. I think all it will actually need to do is to give the results of And I'll probably just make something to source for fish and include it separately to source. |
bin/nvm
for use as a script by any shell