Make `nvm ls-remote iojs [foo]` only show iojs versions, and `nvm ls-remote node [foo]` only show node versions.

master
Jordan Harband 2015-01-13 14:19:58 -08:00
parent 58ab2c3128
commit b0d6c05d6e
1 changed files with 25 additions and 9 deletions

34
nvm.sh
View File

@ -1115,17 +1115,33 @@ nvm() {
return $NVM_LS_EXIT_CODE return $NVM_LS_EXIT_CODE
;; ;;
"ls-remote" | "list-remote" ) "ls-remote" | "list-remote" )
local NVM_LS_REMOTE_OUTPUT local PATTERN
local NVM_LS_REMOTE_EXIT_CODE PATTERN="$2"
NVM_LS_REMOTE_OUTPUT=$(nvm_ls_remote "$2") local NVM_FLAVOR
NVM_LS_REMOTE_EXIT_CODE=$? case "_$PATTERN" in
nvm_print_versions "$NVM_LS_REMOTE_OUTPUT" "_$(nvm_iojs_prefix)" | "_$(nvm_node_prefix)" )
NVM_FLAVOR="$PATTERN"
PATTERN="$3"
;;
esac
local NVM_LS_REMOTE_EXIT_CODE
NVM_LS_REMOTE_EXIT_CODE=0
if [ "_$NVM_FLAVOR" != "_$(nvm_iojs_prefix)" ]; then
local NVM_LS_REMOTE_OUTPUT
NVM_LS_REMOTE_OUTPUT=$(nvm_ls_remote "$PATTERN")
NVM_LS_REMOTE_EXIT_CODE=$?
nvm_print_versions "$NVM_LS_REMOTE_OUTPUT"
fi
local NVM_LS_REMOTE_IOJS_OUTPUT
local NVM_LS_REMOTE_IOJS_EXIT_CODE local NVM_LS_REMOTE_IOJS_EXIT_CODE
NVM_LS_REMOTE_IOJS_OUTPUT=$(nvm_ls_remote_iojs "$2") NVM_LS_REMOTE_IOJS_EXIT_CODE=0
NVM_LS_REMOTE_IOJS_EXIT_CODE=$? if [ "_$NVM_FLAVOR" != "_$(nvm_node_prefix)" ]; then
nvm_print_versions "$NVM_LS_REMOTE_IOJS_OUTPUT" local NVM_LS_REMOTE_IOJS_OUTPUT
NVM_LS_REMOTE_IOJS_OUTPUT=$(nvm_ls_remote_iojs "$PATTERN")
NVM_LS_REMOTE_IOJS_EXIT_CODE=$?
nvm_print_versions "$NVM_LS_REMOTE_IOJS_OUTPUT"
fi
return $NVM_LS_REMOTE_EXIT_CODE && $NVM_LS_REMOTE_IOJS_EXIT_CODE return $NVM_LS_REMOTE_EXIT_CODE && $NVM_LS_REMOTE_IOJS_EXIT_CODE
;; ;;