Use `elif` instead of `else if` where possible to reduce nesting.
authorW. Trevor King <wking@drexel.edu>
Wed, 14 Mar 2012 18:32:31 +0000 (14:32 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 14 Mar 2012 18:32:31 +0000 (14:32 -0400)
dotfiles.sh

index 6bd279d41265ad593b617a86b8975264c3bac381..eb19aa058038856eae96a385cc7851858e57b054 100755 (executable)
@@ -199,11 +199,9 @@ function wget_fetch()
                if [ -n "${SERVER_ETAG}" ]; then  # store new ETag
                        REPO_SOURCE_DATA['etag']="${SERVER_ETAG}"
                        set_repo_source "${REPO}" || return 1
-               else
-                       if [ -n "${ETAG}" ]; then  # clear old ETag
-                               unset "${REPO_SOURCE_DATA['etag']}"
-                               set_repo_source "${REPO}" || return 1
-                       fi
+               elif [ -n "${ETAG}" ]; then  # clear old ETag
+                       unset "${REPO_SOURCE_DATA['etag']}"
+                       set_repo_source "${REPO}" || return 1
                fi
                echo "extracting ${BUNDLE} to ${REPO}"
                "${TAR}" -xf "${BUNDLE}" -C "${REPO}" --strip-components 1 --overwrite || return 1
@@ -433,10 +431,8 @@ function diff()
                        if [ ! -e "${TARGET}/${FILE}" ]; then
                                echo "${FILE}"
                        fi
-               else
-                       if [ -f "${TARGET}/${FILE}" ]; then
-                               (cd "${REPO}/src" && "${DIFF}" -u "${FILE}" "${TARGET}/${FILE}")
-                       fi
+               elif [ -f "${TARGET}/${FILE}" ]; then
+                       (cd "${REPO}/src" && "${DIFF}" -u "${FILE}" "${TARGET}/${FILE}")
                fi
        done <<-EOF
                $(list_files "${REPO}/src")