nvs
nvs copied to clipboard
anyone got this working with fish?
https://fishshell.com/
I had a quick attempt by switching some case
s to if
s, but I'm not sure trying for a compatible subset of bash, zsh and fish is a viable (or desirable) approach /shrug
I have only limited knowledge of fish... But I think the best way to support it might be to create a nvs.fish
script that is a translation of nvs.sh
, similar to how there are .cmd
and .ps1
alternatives for those shells.
It might be helpful to refactor some parts of nvs.sh
(particularly the part that downloads the bootstrap node binary) into a separate script file, which could be invoked by fish
via bash
. But I think the main part (creation of the nvs
function) would have to be done directly in the .fish
script.
I'm not planning to work on this myself, but if someone else would like to contribute I'd be happy to review and merge.
Here's how I got nvs to work with fish on Mac OSX.
Install bass manually using the Makefile.
git clone https://github.com/edc/bass.git
cd bass
make install
Install nvs to ~/.nvs
git clone https://github.com/jasongin/nvs.git ~/.nvs
Create a nvs
function
> funced nvs
function nvs
bass source ~/.nvs/nvs.sh ';' nvs $argv
end
> funcsave nvs
Now you can use the nvs
command
> nvs list
node/10.7.0/x64
node/8.11.3/x64 (Carbon)
chakracore/8.9.4/x64 (Carbon)
> nvs ls-remote latest
*node/10.7.0
Great info, thanks!
Would you like to make a PR to SETUP.md
with these instructions for fish?
Thank you @tomconder, this was very helpful!
EDIT: I had a previous install of node in my path that was breaking my setup. I removed that version and added my nvs default bin directory to my fish paths variable and now nvs link
is working great!
set -U fish_user_paths ~/src/nvs/default/bin $fish_user_paths
NOTE: I cloned nvs into ~/src/nvs
but most of the instructions referrer to ~/.nvs
as the cloned directory
~~However running nvs link <node version>
does not persist the selected node version across terminal sessions because of how fish handles the $PATH variable.~~
~~The workaround I am using is to update the $fish_user_paths variable after installing the desired version of node with nvs~~
I don't plan to PR this since I don't have time to exhaustively test or better factor this but in case it's useful to anyone else, I have a port of nvs.sh to fish at https://github.com/digitalinfinity/nvs/tree/nvs-fish. Warning that it's only been tested on my machine for my mainline nvs scenarios, so YMMV, but if anyone else wants to tackle this issue, my branch might be helpful.