diff --git a/nvm.sh b/nvm.sh index 735d3ec..fc95a04 100755 --- a/nvm.sh +++ b/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 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..09b8931 --- /dev/null +++ "b/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"