Add an `nvm_ls_current` function.
parent
8f66273922
commit
7171cbed6f
8
nvm.sh
8
nvm.sh
|
@ -138,13 +138,17 @@ nvm_binary_available() {
|
||||||
[ $(nvm_normalize_version $VERSION) -ge $(nvm_normalize_version $MINIMAL) ]
|
[ $(nvm_normalize_version $VERSION) -ge $(nvm_normalize_version $MINIMAL) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvm_ls_current() {
|
||||||
|
echo `node -v 2>/dev/null`
|
||||||
|
}
|
||||||
|
|
||||||
nvm_ls() {
|
nvm_ls() {
|
||||||
local PATTERN
|
local PATTERN
|
||||||
PATTERN=$1
|
PATTERN=$1
|
||||||
local VERSIONS
|
local VERSIONS
|
||||||
VERSIONS=''
|
VERSIONS=''
|
||||||
if [ "$PATTERN" = 'current' ]; then
|
if [ "$PATTERN" = 'current' ]; then
|
||||||
echo `node -v 2>/dev/null`
|
nvm_ls_current
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -220,7 +224,7 @@ nvm_print_versions() {
|
||||||
local VERSION
|
local VERSION
|
||||||
local FORMAT
|
local FORMAT
|
||||||
local NVM_CURRENT
|
local NVM_CURRENT
|
||||||
NVM_CURRENT=`nvm_version current`
|
NVM_CURRENT=$(nvm_ls_current)
|
||||||
echo "$1" | while read VERSION; do
|
echo "$1" | while read VERSION; do
|
||||||
if [ "$VERSION" = "$NVM_CURRENT" ]; then
|
if [ "$VERSION" = "$NVM_CURRENT" ]; then
|
||||||
FORMAT='\033[0;32m-> %9s\033[0m'
|
FORMAT='\033[0;32m-> %9s\033[0m'
|
||||||
|
|
Loading…
Reference in New Issue