style: fix inconsistent code style for shell scripts by runing brew style --fix

This commit is contained in:
XuehaiPan 2021-09-16 01:08:02 +08:00
parent bd8db0737d
commit 43377a3e5e
7 changed files with 97 additions and 59 deletions

View File

@ -56,15 +56,42 @@ HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
# HOMEBREW_LIBRARY set by bin/brew # HOMEBREW_LIBRARY set by bin/brew
# shellcheck disable=SC2249,SC2154 # shellcheck disable=SC2249,SC2154
case "$*" in case "$*" in
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;; --cellar)
--repository | --repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;; echo "${HOMEBREW_CELLAR}"
--caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;; exit 0
--cache) echo "${HOMEBREW_CACHE}"; exit 0 ;; ;;
shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;; --repository | --repo)
formulae) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/formulae.sh"; homebrew-formulae; exit 0 ;; echo "${HOMEBREW_REPOSITORY}"
casks) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/casks.sh"; homebrew-casks; exit 0 ;; exit 0
;;
--caskroom)
echo "${HOMEBREW_PREFIX}/Caskroom"
exit 0
;;
--cache)
echo "${HOMEBREW_CACHE}"
exit 0
;;
shellenv)
source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"
homebrew-shellenv
exit 0
;;
formulae)
source "${HOMEBREW_LIBRARY}/Homebrew/cmd/formulae.sh"
homebrew-formulae
exit 0
;;
casks)
source "${HOMEBREW_LIBRARY}/Homebrew/cmd/casks.sh"
homebrew-casks
exit 0
;;
# falls back to cmd/prefix.rb on a non-zero return # falls back to cmd/prefix.rb on a non-zero return
--prefix*) source "${HOMEBREW_LIBRARY}/Homebrew/prefix.sh"; homebrew-prefix "$@" && exit 0 ;; --prefix*)
source "${HOMEBREW_LIBRARY}/Homebrew/prefix.sh"
homebrew-prefix "$@" && exit 0
;;
esac esac
##### #####

View File

@ -11,7 +11,10 @@ homebrew-update-reset() {
for option in "$@" for option in "$@"
do do
case "${option}" in case "${option}" in
-\? | -h | --help | --usage) brew help update-reset; exit $? ;; -\? | -h | --help | --usage)
brew help update-reset
exit $?
;;
--debug) HOMEBREW_DEBUG=1 ;; --debug) HOMEBREW_DEBUG=1 ;;
-*) -*)
[[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1 [[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1

View File

@ -312,7 +312,10 @@ homebrew-update() {
for option in "$@" for option in "$@"
do do
case "${option}" in case "${option}" in
-\? | -h | --help | --usage) brew help update; exit $? ;; -\? | -h | --help | --usage)
brew help update
exit $?
;;
--verbose) HOMEBREW_VERBOSE=1 ;; --verbose) HOMEBREW_VERBOSE=1 ;;
--debug) HOMEBREW_DEBUG=1 ;; --debug) HOMEBREW_DEBUG=1 ;;
--quiet) HOMEBREW_QUIET=1 ;; --quiet) HOMEBREW_QUIET=1 ;;

View File

@ -259,7 +259,10 @@ homebrew-vendor-install() {
for option in "$@" for option in "$@"
do do
case "${option}" in case "${option}" in
-\?|-h|--help|--usage) brew help vendor-install; exit $? ;; -\? | -h | --help | --usage)
brew help vendor-install
exit $?
;;
--verbose) HOMEBREW_VERBOSE=1 ;; --verbose) HOMEBREW_VERBOSE=1 ;;
--quiet) HOMEBREW_QUIET=1 ;; --quiet) HOMEBREW_QUIET=1 ;;
--debug) HOMEBREW_DEBUG=1 ;; --debug) HOMEBREW_DEBUG=1 ;;

View File

@ -10,13 +10,15 @@ homebrew-prefix() {
case "$1" in case "$1" in
# check we actually have --prefix and not e.g. --prefixsomething # check we actually have --prefix and not e.g. --prefixsomething
--prefix) --prefix)
local prefix="1"; shift local prefix="1"
shift
;; ;;
# reject all other flags # reject all other flags
-*) return 1 ;; -*) return 1 ;;
*) *)
[[ -n "${formula}" ]] && return 1 [[ -n "${formula}" ]] && return 1
local formula="$1"; shift local formula="$1"
shift
;; ;;
esac esac
done done