Skip to content
Myr

If nvm is deactivated, display "none" or "system" instead of the system node version

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 6e02e5a · Browse files · 2 files+14 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−2 removed

  • tests:+5 added−1 removed
  • other:+9 added−1 removed

2 files+14 added−2 removed

modified:test/fast/Running "nvm current" should display current nvm environment.+5 added-1 removed
1 unmodified line
23die () { echo $@ ; exit 1; }45. ../../nvm.sh6[ "$(nvm current)" = "$(node -v)" ] || die "Failed to find current version"67nvm deactivate 2>&189[ "$(nvm current)" = "system" ] || [ "$(nvm current)" = "none" ] || die '"nvm current" did not report "system" or "none" when deactivated'10
modified:nvm.sh+9 added-1 removed
158 unmodified lines
159 [ $(nvm_normalize_version $VERSION) -ge $(nvm_normalize_version $MINIMAL) ]160}161162nvm_ls_current() {163 local NODE_PATH164 NODE_PATH="$(which node)"165 if [ $? -ne 0 ]; then166 echo 'none'167 elif nvm_tree_contains_path "$NVM_DIR" "$NODE_PATH"; then163 echo `node -v 2>/dev/null`168 echo `node -v 2>/dev/null`169 else170 echo 'system'171 fi172}173174nvm_ls() {175 local PATTERN
554 unmodified lines