Compare commits

..

5 Commits

Author SHA1 Message Date
Jordan Harband
3e5037a1be v0.10.0 2014-06-26 17:06:45 -07:00
Jordan Harband
60fec40613 Merge pull request #444 from creationix/fix_nvm_ls
Make sure `nvm ls foo` returns a nonzero exit code when a version is not found
2014-06-26 17:04:09 -07:00
Jordan Harband
fb215546ee Don't bother trying to return the exit code of nvm alias or nvm_print_versions 2014-06-26 16:52:48 -07:00
Jordan Harband
4b593bcda2 Make sure these vars are local, where supported 2014-06-26 16:52:34 -07:00
Jordan Harband
8349f0ff48 Make sure nvm ls foo returns a nonzero exit code when a version is not found.
Fixes #440.
2014-06-26 10:28:35 -07:00
4 changed files with 18 additions and 7 deletions

View File

@@ -8,11 +8,11 @@ First you'll need to make sure your system has a c++ compiler. For OSX, XCode w
To install you could use the [install script][2] using cURL:
curl https://raw.githubusercontent.com/creationix/nvm/v0.9.0/install.sh | sh
curl https://raw.githubusercontent.com/creationix/nvm/v0.10.0/install.sh | sh
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.9.0/install.sh | sh
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.10.0/install.sh | sh
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
@@ -163,7 +163,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
nvm install -s 0.8.6
[1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.9.0/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.10.0/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin

10
nvm.sh
View File

@@ -571,11 +571,15 @@ nvm() {
NODE_PATH=$RUN_NODE_PATH $NVM_DIR/$VERSION/bin/node "$@"
;;
"ls" | "list" )
nvm_print_versions "`nvm_ls $2`"
local NVM_LS_OUTPUT
local NVM_LS_EXIT_CODE
NVM_LS_OUTPUT=$(nvm_ls "$2")
NVM_LS_EXIT_CODE=$?
nvm_print_versions "$NVM_LS_OUTPUT"
if [ $# -eq 1 ]; then
nvm alias
fi
return
return $NVM_LS_EXIT_CODE
;;
"ls-remote" | "list-remote" )
nvm_print_versions "`nvm_ls_remote $2`"
@@ -650,7 +654,7 @@ nvm() {
nvm_version $2
;;
"--version" )
echo "0.9.0"
echo "0.10.0"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum nvm_ls_remote nvm_ls nvm_remote_version nvm_version nvm_rc_version > /dev/null 2>&1

View File

@@ -1,6 +1,6 @@
{
"name": "nvm",
"version": "0.9.0",
"version": "0.10.0",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"

View File

@@ -0,0 +1,7 @@
#!/bin/sh
. ../../nvm.sh
nvm ls nonexistent_version
[ "$?" = "3" ]