[shellcheck] Use `-n/-z` instead of `! -z/! -n` condition
https://github.com/koalaman/shellcheck/wiki/SC2236
parent
153506c8da
commit
14179bc8ce
|
@ -7,9 +7,9 @@ nvm_has() {
|
|||
}
|
||||
|
||||
nvm_install_dir() {
|
||||
if [ ! -z "$NVM_DIR" ]; then
|
||||
if [ -n "$NVM_DIR" ]; then
|
||||
printf %s "${NVM_DIR}"
|
||||
elif [ ! -z "$XDG_CONFIG_HOME" ]; then
|
||||
elif [ -n "$XDG_CONFIG_HOME" ]; then
|
||||
printf %s "${XDG_CONFIG_HOME/nvm}"
|
||||
else
|
||||
printf %s "$HOME/.nvm"
|
||||
|
@ -123,7 +123,7 @@ install_nvm_from_git() {
|
|||
fi
|
||||
fi
|
||||
command git -c advice.detachedHead=false --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout -f --quiet "$(nvm_latest_version)"
|
||||
if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
|
||||
if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
|
||||
if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
|
||||
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
|
||||
else
|
||||
|
@ -250,7 +250,7 @@ nvm_detect_profile() {
|
|||
done
|
||||
fi
|
||||
|
||||
if [ ! -z "$DETECTED_PROFILE" ]; then
|
||||
if [ -n "$DETECTED_PROFILE" ]; then
|
||||
echo "$DETECTED_PROFILE"
|
||||
fi
|
||||
}
|
||||
|
|
2
nvm.sh
2
nvm.sh
|
@ -323,7 +323,7 @@ nvm_rc_version() {
|
|||
return 1
|
||||
fi
|
||||
NVM_RC_VERSION="$(command head -n 1 "${NVMRC_PATH}" | command tr -d '\r')" || command printf ''
|
||||
if [ ! -n "${NVM_RC_VERSION}" ]; then
|
||||
if [ -z "${NVM_RC_VERSION}" ]; then
|
||||
nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
|
||||
return 2
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue