[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
Provenance
- Commit
803adac- Tree
a11e518- Author
Jordan Harband <ljharb@gmail.com>- Committer
Jordan Harband <ljharb@gmail.com>- Parent
940f850
1 file changed+25 added−25 removed
modified:nvm.sh+25 added-25 removed
744 unmodified lines745 fi746 ;;747 esac748 749- 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 fi755 756 local NVM_DIRS_TO_SEARCH162 unmodified lines819 " \820 )"821 fi822 823- 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 lines897 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 line909 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 lines1026 if ! nvm_validate_implicit_alias "$NVM_IMPLICIT"; then1027 return 21028 fi1029 1030- local ZHS_HAS_SHWORDSPLIT_UNSET1030+ local ZSH_HAS_SHWORDSPLIT_UNSET1031 1032 local NVM_IOJS_PREFIX1033 NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"1034 local NVM_NODE_PREFIX8 unmodified lines1043 if [ "_$1" = "_local" ]; then1044 NVM_COMMAND="nvm_ls $NVM_IMPLICIT"1045 fi1046 1047- 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 fi1052 1053 local NVM_IOJS_VERSION3 unmodified lines1057 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 fi1060 1061- if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1061+ if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then1062 unsetopt shwordsplit1063 fi1064 1065 if [ "_$NVM_IOJS_VERSION" = "_N/A" ]; then12 unmodified lines1078 if [ "_$1" = "_local" ]; then1079 NVM_COMMAND="nvm_ls node"1080 fi1081 1082- 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 fi1087 1088 LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq)1089 1090- 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 esac2 unmodified lines1097 local UNSTABLE1098 local MOD1099 local NORMALIZED_VERSION1100 1101- 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 lines1115 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 fi1122 1123 if [ "_$2" = '_stable' ]; then664 unmodified lines1788 nvm_echo1789 ;;1790 1791 "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 lines1806 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 lines2255 fi2256 2257 local EXIT_CODE2258 2259- 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 lines2269 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