Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added command to get current nvm environment. #205

Merged
merged 4 commits into from

2 participants

@deiga

As an rvm user I constantly try nvm current and realising I need nvm list, this reduces typing

@deiga

Can we get a merge? :)

@ljharb
Collaborator

A test would be nice :-) but otherwise lgtm

@deiga

There's a simple test now :) Wasn't really sure on how to test this :)

@deiga

Can we get a merge!? :)

..."nvm current" should display current nvm environment.
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+. ../../nvm.sh
+nvm current | grep current
@ljharb Collaborator
ljharb added a note

all of the other tests explicitly return a true or false (using bash bracket notation) - this one just returns content. Can you make this assertion more explicit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@deiga

@ljharb Fixed the test, although I'm not even sure it tests correctly...

@ljharb
Collaborator

This works for me - however node -v tells you the current version just fine.

@ljharb ljharb merged commit d7015c7 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 10, 2013
  1. @deiga
  2. @deiga

    Added test for `nvm current`

    deiga authored
Commits on Dec 17, 2013
  1. @deiga
  2. @deiga
This page is out of date. Refresh to see the latest.
View
3  nvm.sh
@@ -441,6 +441,9 @@ nvm() {
print_versions "`nvm_ls_remote $2`"
return
;;
+ "current" )
+ echo -ne "current: \t"; nvm_version current
+ ;;
"alias" )
mkdir -p $NVM_DIR/alias
if [ $# -le 2 ]; then
View
6 test/fast/Running "nvm current" should display current nvm environment.
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+die () { echo $@ ; exit 1; }
+
+. ../../nvm.sh
+[[ $(nvm current) == *"current"* ]] || die "Failed to find current version"
Something went wrong with that request. Please try again.