Skip to content
Myr

[Fix] ensure proper checking of the “shwordsplit” zsh option.

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 940f850 · Browse files · 1 file+25 added−25 removed
This commit

State

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

Diff stats

1 file+25 added−25 removed

  • other:+25 added−25 removed

1 file+25 added−25 removed

modified:nvm.sh+25 added-25 removed
744 unmodified lines
745 fi746 ;;747 esac748749 local ZHS_HAS_SHWORDSPLIT_UNSET750 ZHS_HAS_SHWORDSPLIT_UNSET=1749 local ZSH_HAS_SHWORDSPLIT_UNSET750 ZSH_HAS_SHWORDSPLIT_UNSET=1751 if nvm_has "setopt"; then752 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)752 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"753 setopt shwordsplit754 fi755756 local NVM_DIRS_TO_SEARCH1
62 unmodified lines
819 " \820 )"821 fi822823 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then823 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then824 unsetopt shwordsplit825 fi826 fi827
69 unmodified lines
897 fi898 else899 PATTERN=".*"900 fi901 ZHS_HAS_SHWORDSPLIT_UNSET=1901 ZSH_HAS_SHWORDSPLIT_UNSET=1902 if nvm_has "setopt"; then903 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)903 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"904 setopt shwordsplit905 fi906 VERSIONS="$(nvm_download -L -s "$MIRROR/index.tab" -o - \907 | command sed "
1 unmodified line
909 s/^/$PREFIX/;910 s/[[:blank:]].*//" \911 | nvm_grep -w "$PATTERN" \912 | $SORT_COMMAND)"913 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then913 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then914 unsetopt shwordsplit915 fi916 if [ -z "$VERSIONS" ]; then917 nvm_echo 'N/A'
108 unmodified lines
1026 if ! nvm_validate_implicit_alias "$NVM_IMPLICIT"; then1027 return 21028 fi10291030 local ZHS_HAS_SHWORDSPLIT_UNSET1030 local ZSH_HAS_SHWORDSPLIT_UNSET10311032 local NVM_IOJS_PREFIX1033 NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"1034 local NVM_NODE_PREFIX
8 unmodified lines
1043 if [ "_$1" = "_local" ]; then1044 NVM_COMMAND="nvm_ls $NVM_IMPLICIT"1045 fi10461047 ZHS_HAS_SHWORDSPLIT_UNSET=11047 ZSH_HAS_SHWORDSPLIT_UNSET=11048 if nvm_has "setopt"; then1049 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)1049 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"1050 setopt shwordsplit1051 fi10521053 local NVM_IOJS_VERSION
3 unmodified lines
1057 if [ "_$EXIT_CODE" = "_0" ]; then1058 NVM_IOJS_VERSION="$(nvm_echo "$NVM_IOJS_VERSION" | command sed "s/^$NVM_IMPLICIT-//" | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq | command tail -1)"1059 fi10601061 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1061 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1062 unsetopt shwordsplit1063 fi10641065 if [ "_$NVM_IOJS_VERSION" = "_N/A" ]; then
12 unmodified lines
1078 if [ "_$1" = "_local" ]; then1079 NVM_COMMAND="nvm_ls node"1080 fi10811082 ZHS_HAS_SHWORDSPLIT_UNSET=11082 ZSH_HAS_SHWORDSPLIT_UNSET=11083 if nvm_has "setopt"; then1084 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)1084 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"1085 setopt shwordsplit1086 fi10871088 LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq)10891090 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1090 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1091 unsetopt shwordsplit1092 fi1093 ;;1094 esac
2 unmodified lines
1097 local UNSTABLE1098 local MOD1099 local NORMALIZED_VERSION11001101 ZHS_HAS_SHWORDSPLIT_UNSET=11101 ZSH_HAS_SHWORDSPLIT_UNSET=11102 if nvm_has "setopt"; then1103 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)1103 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"1104 setopt shwordsplit1105 fi1106 for MINOR in $LAST_TWO; do1107 NORMALIZED_VERSION="$(nvm_normalize_version "$MINOR")"
7 unmodified lines
1115 UNSTABLE="$MINOR"1116 fi1117 fi1118 done1119 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1119 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1120 unsetopt shwordsplit1121 fi11221123 if [ "_$2" = '_stable' ]; then
664 unmodified lines
1788 nvm_echo1789 ;;17901791 "debug" )1792 local ZHS_HAS_SHWORDSPLIT_UNSET1793 ZHS_HAS_SHWORDSPLIT_UNSET=11792 local ZSH_HAS_SHWORDSPLIT_UNSET1793 ZSH_HAS_SHWORDSPLIT_UNSET=11794 if nvm_has "setopt"; then1795 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)1795 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"1796 setopt shwordsplit1797 fi1798 nvm_err "nvm --version: v$(nvm --version)"1799 nvm_err "\$SHELL: $SHELL"
6 unmodified lines
1806 do1807 NVM_DEBUG_OUTPUT="$($NVM_DEBUG_COMMAND 2>&1)"1808 nvm_err "$NVM_DEBUG_COMMAND: $(nvm_sanitize_path "$NVM_DEBUG_OUTPUT")"1809 done1810 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1810 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1811 unsetopt shwordsplit1812 fi1813 return 421814 ;;
440 unmodified lines
2255 fi22562257 local EXIT_CODE22582259 local ZHS_HAS_SHWORDSPLIT_UNSET2260 ZHS_HAS_SHWORDSPLIT_UNSET=12259 local ZSH_HAS_SHWORDSPLIT_UNSET2260 ZSH_HAS_SHWORDSPLIT_UNSET=12261 if nvm_has "setopt"; then2262 ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?)2262 ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"2263 setopt shwordsplit2264 fi2265 if [ "_$VERSION" = "_N/A" ]; then2266 nvm_ensure_version_installed "$provided_version"
2 unmodified lines
2269 else2270 nvm exec "${NVM_SILENT-}" "$VERSION" node "$@"2271 fi2272 EXIT_CODE="$?"2273 if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then2273 if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then2274 unsetopt shwordsplit2275 fi2276 return $EXIT_CODE2277 ;;
366 unmodified lines