Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–265 unchanged (265 lines)
266 local EXIT_CODE
267 LOCAL_VERSION="$(nvm_version "${PROVIDED_VERSION}")"
268 EXIT_CODE="$?"
269 local NVM_VERSION_DIR
270 if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then
271 VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")"
272 if [ $? -eq 0 ]; then
273 nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed."
274 nvm_err ""
275 nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
276 else
277 local PREFIXED_VERSION
278 PREFIXED_VERSION="$(nvm_ensure_version_prefix "${PROVIDED_VERSION}")"
…lines 279–659 unchanged (381 lines)
660 command cat "${NVM_ALIAS_PATH}"
661}
662
663nvm_ls_current() {
664 local NVM_LS_CURRENT_NODE_PATH
665 NVM_LS_CURRENT_NODE_PATH="$(command which node 2> /dev/null)"
666 if [ $? -ne 0 ]; then
667 nvm_echo 'none'
668 elif nvm_tree_contains_path "$(nvm_version_dir iojs)" "${NVM_LS_CURRENT_NODE_PATH}"; then
669 nvm_add_iojs_prefix "$(iojs --version 2>/dev/null)"
670 elif nvm_tree_contains_path "${NVM_DIR}" "${NVM_LS_CURRENT_NODE_PATH}"; then
671 local VERSION
672 VERSION="$(node --version 2>/dev/null)"
…lines 673–3273 unchanged (2601 lines)

After

…lines 1–265 unchanged (265 lines)
266 local EXIT_CODE
267 LOCAL_VERSION="$(nvm_version "${PROVIDED_VERSION}")"
268 EXIT_CODE="$?"
269 local NVM_VERSION_DIR
270 if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then
271 VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")"
272 # shellcheck disable=SC2181
273 if [ $? -eq 0 ]; then
274 nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed."
275 nvm_err ""
276 nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
277 else
278 local PREFIXED_VERSION
…lines 279–660 unchanged (382 lines)
661 command cat "${NVM_ALIAS_PATH}"
662}
663
664nvm_ls_current() {
665 local NVM_LS_CURRENT_NODE_PATH
666 NVM_LS_CURRENT_NODE_PATH="$(command which node 2> /dev/null)"
667 # shellcheck disable=SC2181
668 if [ $? -ne 0 ]; then
669 nvm_echo 'none'
670 elif nvm_tree_contains_path "$(nvm_version_dir iojs)" "${NVM_LS_CURRENT_NODE_PATH}"; then
671 nvm_add_iojs_prefix "$(iojs --version 2>/dev/null)"
672 elif nvm_tree_contains_path "${NVM_DIR}" "${NVM_LS_CURRENT_NODE_PATH}"; then
673 local VERSION
…lines 674–3275 unchanged (2602 lines)

Before

program
comment "# Node Version Manager"
comment "# Implemented as a POSIX-compliant function"
comment "# Should work on sh, dash, bash, ksh, zsh"
comment "# To use source this file from your bash profile"
comment "#"
comment "# Implemented by Tim Caswell <tim@creationix.com>"
comment "# with much bash help from Matthew Ranney"
comment "# \"local\" warning, quote expansion warning"
comment "# shellcheck disable=SC2039,SC2016,SC2001"
compound_statement
{ "{"
comment "# this ensures the entire script is downloaded #"
variable_assignment
variable_name "NVM_SCRIPT_SOURCE"
= "="
string
" "\""
simple_expansion
$ "$"
special_variable_name "_"
" "\""
function_definition (+56 nodes collapsed)
function_definition
word "nvm_cd"
( "("
) ")"
compound_statement
{ "{"
comment "# shellcheck disable=SC1001,SC2164"
command
command_name
word "\\cd"
string
" "\""
simple_expansion
$ "$"
special_variable_name "@"
" "\""
} "}"
function_definition
word "nvm_err"
( "("
) ")"
compound_statement
{ "{"
command
file_redirect
>& ">&"
number "2"
command_name
word "nvm_echo"
string
" "\""
simple_expansion
$ "$"
special_variable_name "@"
" "\""
} "}"
function_definition (+21 nodes collapsed)
function_definition (+26 nodes collapsed)
function_definition (+28 nodes collapsed)
function_definition (+48 nodes collapsed)
function_definition (+135 nodes collapsed)
function_definition (+82 nodes collapsed)
function_definition (+38 nodes collapsed)
function_definition (+38 nodes collapsed)
function_definition (+49 nodes collapsed)
function_definition (+40 nodes collapsed)
comment "# Make zsh glob matching behave same as bash"
comment "# This fixes the \"zsh: no matches found\" errors"
if_statement (+24 nodes collapsed)
if_statement (+28 nodes collapsed)
comment "# Auto detect the NVM_DIR when not set"
if_statement (+101 nodes collapsed)
redirected_statement
unset_command
unset "unset"
variable_name "NVM_SCRIPT_SOURCE"
file_redirect
file_descriptor "2"
> ">"
word "/dev/null"
comment "# Setup mirror location if not already set"
if_statement (+27 nodes collapsed)
if_statement (+27 nodes collapsed)
function_definition (+221 nodes collapsed)
comment "# Traverse up in directory tree to find containing folder"
function_definition (+82 nodes collapsed)
function_definition (+52 nodes collapsed)
comment "# Obtain nvm version from rc file"
function_definition (+131 nodes collapsed)
function_definition (+24 nodes collapsed)
function_definition (+31 nodes collapsed)
function_definition (+31 nodes collapsed)
function_definition (+140 nodes collapsed)
function_definition (+21 nodes collapsed)
function_definition (+140 nodes collapsed)
function_definition
word "nvm_ensure_version_installed"
( "("
) ")"
compound_statement
{ "{"
declaration_command
local "local"
variable_name "PROVIDED_VERSION"
variable_assignment
variable_name "PROVIDED_VERSION"
= "="
string
" "\""
expansion
${ "${"
variable_name "1"
- "-"
} "}"
" "\""
declaration_command
local "local"
variable_name "LOCAL_VERSION"
declaration_command
local "local"
variable_name "EXIT_CODE"
variable_assignment
variable_name "LOCAL_VERSION"
= "="
string
" "\""
command_substitution
$( "$("
command
command_name
word "nvm_version"
string
" "\""
expansion
${ "${"
variable_name "PROVIDED_VERSION"
} "}"
" "\""
) ")"
" "\""
variable_assignment
variable_name "EXIT_CODE"
= "="
string
" "\""
simple_expansion
$ "$"
special_variable_name "?"
" "\""
declaration_command
local "local"
variable_name "NVM_VERSION_DIR"
if_statement
if "if"
list (+30 nodes collapsed)
; ";"
then "then"
variable_assignment
variable_name "VERSION"
= "="
string
" "\""
command_substitution
$( "$("
command
command_name
word "nvm_resolve_alias"
string
" "\""
expansion
${ "${"
variable_name "PROVIDED_VERSION"
} "}"
" "\""
) ")"
" "\""
if_statement (+107 nodes collapsed)
command
command_name
word "return"
number "1"
fi "fi"
} "}"
comment "# Expand a version using the version cache"
function_definition (+217 nodes collapsed)
function_definition (+244 nodes collapsed)
function_definition (+483 nodes collapsed)
function_definition (+108 nodes collapsed)
function_definition (+21 nodes collapsed)
function_definition (+76 nodes collapsed)
function_definition (+103 nodes collapsed)
function_definition (+125 nodes collapsed)
function_definition (+146 nodes collapsed)
function_definition (+55 nodes collapsed)
function_definition (+29 nodes collapsed)
function_definition (+522 nodes collapsed)
function_definition (+192 nodes collapsed)
function_definition (+118 nodes collapsed)
function_definition (+124 nodes collapsed)
function_definition (+353 nodes collapsed)
function_definition (+104 nodes collapsed)
function_definition
word "nvm_ls_current"
( "("
) ")"
compound_statement
{ "{"
declaration_command
local "local"
variable_name "NVM_LS_CURRENT_NODE_PATH"
variable_assignment
variable_name "NVM_LS_CURRENT_NODE_PATH"
= "="
string
" "\""
command_substitution
$( "$("
redirected_statement
command
command_name
word "command"
word "which"
word "node"
file_redirect
file_descriptor "2"
> ">"
word "/dev/null"
) ")"
" "\""
if_statement (+145 nodes collapsed)
} "}"
function_definition (+431 nodes collapsed)
function_definition (+125 nodes collapsed)
function_definition
word "nvm_iojs_prefix"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_echo"
raw_string "'iojs'"
} "}"
function_definition
word "nvm_node_prefix"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_echo"
raw_string "'node'"
} "}"
function_definition (+31 nodes collapsed)
function_definition (+43 nodes collapsed)
function_definition (+71 nodes collapsed)
function_definition (+1285 nodes collapsed)
function_definition (+161 nodes collapsed)
function_definition (+31 nodes collapsed)
comment "# args flavor, type, version"
function_definition (+656 nodes collapsed)
function_definition (+282 nodes collapsed)
function_definition (+531 nodes collapsed)
function_definition (+218 nodes collapsed)
comment "# args: flavor, type, version, slug, compression"
function_definition (+195 nodes collapsed)
function_definition (+654 nodes collapsed)
function_definition (+490 nodes collapsed)
function_definition (+99 nodes collapsed)
function_definition (+908 nodes collapsed)
function_definition (+88 nodes collapsed)
function_definition (+230 nodes collapsed)
function_definition (+175 nodes collapsed)
function_definition (+116 nodes collapsed)
function_definition
word "nvm_is_merged_node_version"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_version_greater_than_or_equal_to"
string
" "\""
simple_expansion
$ "$"
variable_name "1"
" "\""
word "v4.0.0"
} "}"
function_definition (+63 nodes collapsed)
comment "# args: flavor, type, version, reinstall"
function_definition (+524 nodes collapsed)
comment "# args: flavor, kind, version"
function_definition (+269 nodes collapsed)
comment "# args: flavor, kind, type, version"
function_definition (+856 nodes collapsed)
function_definition (+358 nodes collapsed)
comment "# args: flavor, type, version, make jobs, additional"
function_definition (+803 nodes collapsed)
function_definition (+87 nodes collapsed)
function_definition (+199 nodes collapsed)
function_definition (+397 nodes collapsed)
comment "# Succeeds if $IOJS_VERSION represents an io.js version that"...
comment "# Solaris binary, fails otherwise."
comment "# Currently, only io.js 3.3.1 has a Solaris binary available"...
comment "# latest io.js version available. The expectation is that an"...
comment "# version later than v3.3.1 will also have Solaris binaries."
function_definition (+78 nodes collapsed)
comment "# Succeeds if $NODE_VERSION represents a node version that h"...
comment "# Solaris binary, fails otherwise."
comment "# Currently, node versions starting from v0.8.6 have a Solar"...
comment "# avaliable."
function_definition (+96 nodes collapsed)
comment "# Succeeds if $VERSION represents a version (node, io.js or "...
comment "# Solaris binary, fails otherwise."
function_definition (+67 nodes collapsed)
function_definition (+144 nodes collapsed)
function_definition (+81 nodes collapsed)
comment "# Check version dir permissions"
function_definition (+292 nodes collapsed)
function_definition
word "nvm_cache_dir"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_echo"
string
" "\""
expansion
${ "${"
variable_name "NVM_DIR"
} "}"
string_content "/.cache"
" "\""
} "}"
function_definition (+7796 nodes collapsed)
function_definition (+40 nodes collapsed)
function_definition (+213 nodes collapsed)
function_definition (+238 nodes collapsed)
function_definition (+74 nodes collapsed)
command
command_name
word "nvm_process_parameters"
string
" "\""
simple_expansion
$ "$"
special_variable_name "@"
" "\""
} "}"
comment "# this ensures the entire script is downloaded #"

After

program
comment "# Node Version Manager"
comment "# Implemented as a POSIX-compliant function"
comment "# Should work on sh, dash, bash, ksh, zsh"
comment "# To use source this file from your bash profile"
comment "#"
comment "# Implemented by Tim Caswell <tim@creationix.com>"
comment "# with much bash help from Matthew Ranney"
comment "# \"local\" warning, quote expansion warning"
comment "# shellcheck disable=SC2039,SC2016,SC2001"
compound_statement
{ "{"
comment "# this ensures the entire script is downloaded #"
variable_assignment
variable_name "NVM_SCRIPT_SOURCE"
= "="
string
" "\""
simple_expansion
$ "$"
special_variable_name "_"
" "\""
function_definition (+56 nodes collapsed)
function_definition
word "nvm_cd"
( "("
) ")"
compound_statement
{ "{"
comment "# shellcheck disable=SC1001,SC2164"
command
command_name
word "\\cd"
string
" "\""
simple_expansion
$ "$"
special_variable_name "@"
" "\""
} "}"
function_definition
word "nvm_err"
( "("
) ")"
compound_statement
{ "{"
command
file_redirect
>& ">&"
number "2"
command_name
word "nvm_echo"
string
" "\""
simple_expansion
$ "$"
special_variable_name "@"
" "\""
} "}"
function_definition (+21 nodes collapsed)
function_definition (+26 nodes collapsed)
function_definition (+28 nodes collapsed)
function_definition (+48 nodes collapsed)
function_definition (+135 nodes collapsed)
function_definition (+82 nodes collapsed)
function_definition (+38 nodes collapsed)
function_definition (+38 nodes collapsed)
function_definition (+49 nodes collapsed)
function_definition (+40 nodes collapsed)
comment "# Make zsh glob matching behave same as bash"
comment "# This fixes the \"zsh: no matches found\" errors"
if_statement (+24 nodes collapsed)
if_statement (+28 nodes collapsed)
comment "# Auto detect the NVM_DIR when not set"
if_statement (+101 nodes collapsed)
redirected_statement
unset_command
unset "unset"
variable_name "NVM_SCRIPT_SOURCE"
file_redirect
file_descriptor "2"
> ">"
word "/dev/null"
comment "# Setup mirror location if not already set"
if_statement (+27 nodes collapsed)
if_statement (+27 nodes collapsed)
function_definition (+221 nodes collapsed)
comment "# Traverse up in directory tree to find containing folder"
function_definition (+82 nodes collapsed)
function_definition (+52 nodes collapsed)
comment "# Obtain nvm version from rc file"
function_definition (+131 nodes collapsed)
function_definition (+24 nodes collapsed)
function_definition (+31 nodes collapsed)
function_definition (+31 nodes collapsed)
function_definition (+140 nodes collapsed)
function_definition (+21 nodes collapsed)
function_definition (+140 nodes collapsed)
function_definition
word "nvm_ensure_version_installed"
( "("
) ")"
compound_statement
{ "{"
declaration_command
local "local"
variable_name "PROVIDED_VERSION"
variable_assignment
variable_name "PROVIDED_VERSION"
= "="
string
" "\""
expansion
${ "${"
variable_name "1"
- "-"
} "}"
" "\""
declaration_command
local "local"
variable_name "LOCAL_VERSION"
declaration_command
local "local"
variable_name "EXIT_CODE"
variable_assignment
variable_name "LOCAL_VERSION"
= "="
string
" "\""
command_substitution
$( "$("
command
command_name
word "nvm_version"
string
" "\""
expansion
${ "${"
variable_name "PROVIDED_VERSION"
} "}"
" "\""
) ")"
" "\""
variable_assignment
variable_name "EXIT_CODE"
= "="
string
" "\""
simple_expansion
$ "$"
special_variable_name "?"
" "\""
declaration_command
local "local"
variable_name "NVM_VERSION_DIR"
if_statement
if "if"
list (+30 nodes collapsed)
; ";"
then "then"
variable_assignment
variable_name "VERSION"
= "="
string
" "\""
command_substitution
$( "$("
command
command_name
word "nvm_resolve_alias"
string
" "\""
expansion
${ "${"
variable_name "PROVIDED_VERSION"
} "}"
" "\""
) ")"
" "\""
comment "# shellcheck disable=SC2181"
if_statement (+107 nodes collapsed)
command
command_name
word "return"
number "1"
fi "fi"
} "}"
comment "# Expand a version using the version cache"
function_definition (+217 nodes collapsed)
function_definition (+244 nodes collapsed)
function_definition (+483 nodes collapsed)
function_definition (+108 nodes collapsed)
function_definition (+21 nodes collapsed)
function_definition (+76 nodes collapsed)
function_definition (+103 nodes collapsed)
function_definition (+125 nodes collapsed)
function_definition (+146 nodes collapsed)
function_definition (+55 nodes collapsed)
function_definition (+29 nodes collapsed)
function_definition (+522 nodes collapsed)
function_definition (+192 nodes collapsed)
function_definition (+118 nodes collapsed)
function_definition (+124 nodes collapsed)
function_definition (+353 nodes collapsed)
function_definition (+104 nodes collapsed)
function_definition
word "nvm_ls_current"
( "("
) ")"
compound_statement
{ "{"
declaration_command
local "local"
variable_name "NVM_LS_CURRENT_NODE_PATH"
variable_assignment
variable_name "NVM_LS_CURRENT_NODE_PATH"
= "="
string
" "\""
command_substitution
$( "$("
redirected_statement
command
command_name
word "command"
word "which"
word "node"
file_redirect
file_descriptor "2"
> ">"
word "/dev/null"
) ")"
" "\""
comment "# shellcheck disable=SC2181"
if_statement (+145 nodes collapsed)
} "}"
function_definition (+431 nodes collapsed)
function_definition (+125 nodes collapsed)
function_definition
word "nvm_iojs_prefix"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_echo"
raw_string "'iojs'"
} "}"
function_definition
word "nvm_node_prefix"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_echo"
raw_string "'node'"
} "}"
function_definition (+31 nodes collapsed)
function_definition (+43 nodes collapsed)
function_definition (+71 nodes collapsed)
function_definition (+1285 nodes collapsed)
function_definition (+161 nodes collapsed)
function_definition (+31 nodes collapsed)
comment "# args flavor, type, version"
function_definition (+656 nodes collapsed)
function_definition (+282 nodes collapsed)
function_definition (+531 nodes collapsed)
function_definition (+218 nodes collapsed)
comment "# args: flavor, type, version, slug, compression"
function_definition (+195 nodes collapsed)
function_definition (+654 nodes collapsed)
function_definition (+490 nodes collapsed)
function_definition (+99 nodes collapsed)
function_definition (+908 nodes collapsed)
function_definition (+88 nodes collapsed)
function_definition (+230 nodes collapsed)
function_definition (+175 nodes collapsed)
function_definition (+116 nodes collapsed)
function_definition
word "nvm_is_merged_node_version"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_version_greater_than_or_equal_to"
string
" "\""
simple_expansion
$ "$"
variable_name "1"
" "\""
word "v4.0.0"
} "}"
function_definition (+63 nodes collapsed)
comment "# args: flavor, type, version, reinstall"
function_definition (+524 nodes collapsed)
comment "# args: flavor, kind, version"
function_definition (+269 nodes collapsed)
comment "# args: flavor, kind, type, version"
function_definition (+856 nodes collapsed)
function_definition (+358 nodes collapsed)
comment "# args: flavor, type, version, make jobs, additional"
function_definition (+803 nodes collapsed)
function_definition (+87 nodes collapsed)
function_definition (+199 nodes collapsed)
function_definition (+397 nodes collapsed)
comment "# Succeeds if $IOJS_VERSION represents an io.js version that"...
comment "# Solaris binary, fails otherwise."
comment "# Currently, only io.js 3.3.1 has a Solaris binary available"...
comment "# latest io.js version available. The expectation is that an"...
comment "# version later than v3.3.1 will also have Solaris binaries."
function_definition (+78 nodes collapsed)
comment "# Succeeds if $NODE_VERSION represents a node version that h"...
comment "# Solaris binary, fails otherwise."
comment "# Currently, node versions starting from v0.8.6 have a Solar"...
comment "# avaliable."
function_definition (+96 nodes collapsed)
comment "# Succeeds if $VERSION represents a version (node, io.js or "...
comment "# Solaris binary, fails otherwise."
function_definition (+67 nodes collapsed)
function_definition (+144 nodes collapsed)
function_definition (+81 nodes collapsed)
comment "# Check version dir permissions"
function_definition (+292 nodes collapsed)
function_definition
word "nvm_cache_dir"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "nvm_echo"
string
" "\""
expansion
${ "${"
variable_name "NVM_DIR"
} "}"
string_content "/.cache"
" "\""
} "}"
function_definition (+7796 nodes collapsed)
function_definition (+40 nodes collapsed)
function_definition (+213 nodes collapsed)
function_definition (+238 nodes collapsed)
function_definition (+74 nodes collapsed)
command
command_name
word "nvm_process_parameters"
string
" "\""
simple_expansion
$ "$"
special_variable_name "@"
" "\""
} "}"
comment "# this ensures the entire script is downloaded #"