oh my fish, bass and nvm

This commit is contained in:
2021-09-04 10:44:01 +01:00
parent 2040d6ff85
commit 006fb7381e
6 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
function load_nvm --on-variable="PWD"
set -l default_node_version (nvm version default)
set -l node_version (nvm version)
set -l nvmrc_path (nvm_find_nvmrc)
if test -n "$nvmrc_path"
set -l nvmrc_node_version (nvm version (cat $nvmrc_path))
if test "$nvmrc_node_version" = "N/A"
nvm install (cat $nvmrc_path)
else if test nvmrc_node_version != node_version
nvm use $nvmrc_node_version
end
else if test "$node_version" != "$default_node_version"
echo "Reverting to default Node version"
nvm use default
end
end

View File

@@ -0,0 +1,3 @@
function nvm
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
end

View File

@@ -0,0 +1,3 @@
function nvm_find_nvmrc
bass source ~/.nvm/nvm.sh --no-use ';' nvm_find_nvmrc
end