From dd157129a6fc6ac2168528b3bb41066138c7472d Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Wed, 13 Mar 2013 13:21:30 +0000 Subject: [PATCH 1/3] Added command to get current nvm environment. --- nvm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvm.sh b/nvm.sh index e4ce9f8..27db03e 100755 --- a/nvm.sh +++ b/nvm.sh @@ -436,6 +436,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 From dc7a42062ec2412957e63cc2b84fd3bd66733b35 Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Thu, 10 Oct 2013 07:58:51 +0300 Subject: [PATCH 2/3] Added test for `nvm current` --- ...g \"nvm current\" should display current nvm environment." | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 "test/fast/Running \"nvm current\" should display current nvm environment." diff --git "a/test/fast/Running \"nvm current\" should display current nvm environment." "b/test/fast/Running \"nvm current\" should display current nvm environment." new file mode 100755 index 0000000..bc80cf6 --- /dev/null +++ "b/test/fast/Running \"nvm current\" should display current nvm environment." @@ -0,0 +1,4 @@ +#!/bin/sh + +. ../../nvm.sh +nvm current | grep current From 4ca71d81cfe02e2ffb13234e913c18508968d8e1 Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Tue, 17 Dec 2013 08:28:31 +0200 Subject: [PATCH 3/3] Changed test according to comments --- ...g \"nvm current\" should display current nvm environment." | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git "a/test/fast/Running \"nvm current\" should display current nvm environment." "b/test/fast/Running \"nvm current\" should display current nvm environment." index bc80cf6..09b8931 100755 --- "a/test/fast/Running \"nvm current\" should display current nvm environment." +++ "b/test/fast/Running \"nvm current\" should display current nvm environment." @@ -1,4 +1,6 @@ #!/bin/sh +die () { echo $@ ; exit 1; } + . ../../nvm.sh -nvm current | grep current +[[ $(nvm current) == *"current"* ]] || die "Failed to find current version"