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

Jordan Harband 2016-07-08 02:11:51 -07:00
parent 940f850f8d
commit 803adac676
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 25 additions and 25 deletions

50
nvm.sh
View File

@ -746,10 +746,10 @@ nvm_ls() {
;; ;;
esac esac
local ZHS_HAS_SHWORDSPLIT_UNSET local ZSH_HAS_SHWORDSPLIT_UNSET
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
@ -820,7 +820,7 @@ nvm_ls() {
)" )"
fi fi
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
fi fi
@ -898,9 +898,9 @@ nvm_ls_remote_index_tab() {
else else
PATTERN=".*" PATTERN=".*"
fi fi
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
VERSIONS="$(nvm_download -L -s "$MIRROR/index.tab" -o - \ VERSIONS="$(nvm_download -L -s "$MIRROR/index.tab" -o - \
@ -910,7 +910,7 @@ nvm_ls_remote_index_tab() {
s/[[:blank:]].*//" \ s/[[:blank:]].*//" \
| nvm_grep -w "$PATTERN" \ | nvm_grep -w "$PATTERN" \
| $SORT_COMMAND)" | $SORT_COMMAND)"
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
if [ -z "$VERSIONS" ]; then if [ -z "$VERSIONS" ]; then
@ -1027,7 +1027,7 @@ nvm_print_implicit_alias() {
return 2 return 2
fi fi
local ZHS_HAS_SHWORDSPLIT_UNSET local ZSH_HAS_SHWORDSPLIT_UNSET
local NVM_IOJS_PREFIX local NVM_IOJS_PREFIX
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)" NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
@ -1044,9 +1044,9 @@ nvm_print_implicit_alias() {
NVM_COMMAND="nvm_ls $NVM_IMPLICIT" NVM_COMMAND="nvm_ls $NVM_IMPLICIT"
fi fi
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
@ -1058,7 +1058,7 @@ nvm_print_implicit_alias() {
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)" 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)"
fi fi
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
@ -1079,15 +1079,15 @@ nvm_print_implicit_alias() {
NVM_COMMAND="nvm_ls node" NVM_COMMAND="nvm_ls node"
fi fi
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq) LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq)
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
;; ;;
@ -1098,9 +1098,9 @@ nvm_print_implicit_alias() {
local MOD local MOD
local NORMALIZED_VERSION local NORMALIZED_VERSION
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
for MINOR in $LAST_TWO; do for MINOR in $LAST_TWO; do
@ -1116,7 +1116,7 @@ nvm_print_implicit_alias() {
fi fi
fi fi
done done
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
@ -1789,10 +1789,10 @@ nvm() {
;; ;;
"debug" ) "debug" )
local ZHS_HAS_SHWORDSPLIT_UNSET local ZSH_HAS_SHWORDSPLIT_UNSET
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
nvm_err "nvm --version: v$(nvm --version)" nvm_err "nvm --version: v$(nvm --version)"
@ -1807,7 +1807,7 @@ nvm() {
NVM_DEBUG_OUTPUT="$($NVM_DEBUG_COMMAND 2>&1)" NVM_DEBUG_OUTPUT="$($NVM_DEBUG_COMMAND 2>&1)"
nvm_err "$NVM_DEBUG_COMMAND: $(nvm_sanitize_path "$NVM_DEBUG_OUTPUT")" nvm_err "$NVM_DEBUG_COMMAND: $(nvm_sanitize_path "$NVM_DEBUG_OUTPUT")"
done done
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
return 42 return 42
@ -2256,10 +2256,10 @@ nvm() {
local EXIT_CODE local EXIT_CODE
local ZHS_HAS_SHWORDSPLIT_UNSET local ZSH_HAS_SHWORDSPLIT_UNSET
ZHS_HAS_SHWORDSPLIT_UNSET=1 ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then if nvm_has "setopt"; then
ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | nvm_grep shwordsplit > /dev/null ; nvm_echo $?) ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit setopt shwordsplit
fi fi
if [ "_$VERSION" = "_N/A" ]; then if [ "_$VERSION" = "_N/A" ]; then
@ -2270,7 +2270,7 @@ nvm() {
nvm exec "${NVM_SILENT-}" "$VERSION" node "$@" nvm exec "${NVM_SILENT-}" "$VERSION" node "$@"
fi fi
EXIT_CODE="$?" EXIT_CODE="$?"
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit
fi fi
return $EXIT_CODE return $EXIT_CODE