Open runofthemill opened 5 years ago
Thanks, I tried ~and failed~ to write an urchin test for this, ~but~ it's working for me locally!
Whoops! I forgot about tests, didn't see the test failed until just now. Thanks @amirdt22 - I'll take a look at your PR :)
@amirdt22 @lukechilds any thoughts on why the tests are failing? Running the tests locally with urchin fails on NVM_LAZY_LOAD && NVM_NO_USE
, but every other test passes.
@runofthemill, first of all, thank you a lot man for this PR but I have a weird issue maybe it's the reason for the failing tests or something
my prompt shows the node version and strangely when I navigate to project has .nvmrc it shows the message as it already loaded
but I had to run any command first so it runs properly and shows the real node version
snowflake in saleor on master is 📦 v0.0.0 via ⬢ Found '/Users/snowflake/Playground/saleor/.nvmrc' with version <10.15.2>
Now using node v10.15.2 (npm v6.4.1)
v10.15.2 on 🐳 v19.03.8 via 🐍 system
[I] ➜ node -v
Found '/Users/snowflake/Playground/saleor/.nvmrc' with version <10.15.2>
Now using node v10.15.2 (npm v6.4.1)
v10.15.2
snowflake in saleor on master is 📦 v0.0.0 via ⬢ v10.15.2 on 🐳 v19.03.8 via 🐍 system took 3s
[I] ➜
@MuhmdRaouf you're talking about how it's showing the message inside your prompt? how is that section of your prompt defined?
@runofthemill I am using Zsh SpaceShip Theme and it shows the current node version, whenever I move to the folder contain .nvmrc file instead of showing node version it shows,
Found '/Users/snowflake/Playground/saleor/.nvmrc' with version <10.15.2>
Now using node v10.15.2 (npm v6.4.1)
v10.15.2
instead of node version.
@MuhmdRaouf I just checked and looks like the theme would need to add some logic here:
In iTerm2 I use this to conditionally set the node version in the app status bar, you could probably use something similar in the theme:
function set_node_version() {
if (type _zsh_nvm_nvm &>/dev/null); then
echo $(nvm current)
else
echo "unset"
fi
}
@lukechilds I finally got tests to pass (yay escaping things!) - would love your thoughts on the PR whenever you get a chance!
This is what you should do here:
[[ \"$NVM_AUTO_USE\" == true ]] && _zsh_nvm_auto_use The hooks are already loaded, you just need to run _zsh_nvm_auto_use after loading nvm
Right now,
NVM_AUTO_USE=true
will not get applied on the initial call ofnvm
/npm
/node
/yarn
, and only work on subsequent session directory changes. This PR makesNVM_AUTO_USE=true
go into effect at the first invocation whenNVM_LAZY_LOAD=true
.Note - I'm good enough at tinkering in shell scripts, but totally could be doing something dumb here! Thanks for taking a look and making a great plugin!