Fix shellcheck style errors

This commit is contained in:
Gautham Goli 2021-05-18 17:10:20 +05:30
parent 1810ff9722
commit e4118bc4ca
6 changed files with 23 additions and 15 deletions

View File

@ -51,9 +51,9 @@ HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}" HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}" HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
# These referenced variables are set by bin/brew
# Don't need to handle a default case. # Don't need to handle a default case.
# shellcheck disable=SC2154,SC2249 # HOMEBREW_LIBRARY set by bin/brew
# shellcheck disable=SC2249,SC2154
case "$*" in case "$*" in
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;; --cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
--repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;; --repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
@ -315,6 +315,8 @@ then
fi fi
HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core"
# Used in --version.sh
# shellcheck disable=SC2034
HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask"
case "$*" in case "$*" in

View File

@ -3,7 +3,9 @@
#: List all locally installable formulae including short names. #: List all locally installable formulae including short names.
#: #:
source "$HOMEBREW_LIBRARY/Homebrew/items.sh" # HOMEBREW_LIBRARY is set by bin/brew
# shellcheck disable=SC2154
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"
homebrew-formulae() { homebrew-formulae() {
homebrew-items 'Casks' 's|/Formula/|/|' '^homebrew/core' homebrew-items 'Casks' 's|/Formula/|/|' '^homebrew/core'

View File

@ -444,6 +444,8 @@ EOS
QUIET_ARGS=() QUIET_ARGS=()
fi fi
# HOMEBREW_CURLRC isn't misspelt here
# shellcheck disable=SC2153
if [[ -z "${HOMEBREW_CURLRC}" ]] if [[ -z "${HOMEBREW_CURLRC}" ]]
then then
CURL_DISABLE_CURLRC_ARGS=(-q) CURL_DISABLE_CURLRC_ARGS=(-q)

View File

@ -82,6 +82,8 @@ fetch() {
curl_args=() curl_args=()
# do not load .curlrc unless requested (must be the first argument) # do not load .curlrc unless requested (must be the first argument)
# HOMEBREW_CURLRC isn't misspelt here
# shellcheck disable=SC2153
if [[ -z "${HOMEBREW_CURLRC}" ]] if [[ -z "${HOMEBREW_CURLRC}" ]]
then then
curl_args[${#curl_args[*]}]="-q" curl_args[${#curl_args[*]}]="-q"

View File

@ -138,32 +138,32 @@ _brew() {
local i=1 cmd local i=1 cmd
# find the subcommand # find the subcommand
while [[ "$i" -lt "$COMP_CWORD" ]] while [[ "${i}" -lt "${COMP_CWORD}" ]]
do do
local s="${COMP_WORDS[i]}" local s="${COMP_WORDS[i]}"
case "$s" in case "${s}" in
--*) --*)
cmd="$s" cmd="${s}"
break break
;; ;;
-*) -*)
;; ;;
*) *)
cmd="$s" cmd="${s}"
break break
;; ;;
esac esac
(( i++ )) (( i++ ))
done done
if [[ "$i" -eq "$COMP_CWORD" ]] if [[ "${i}" -eq "${COMP_CWORD}" ]]
then then
__brew_complete_commands __brew_complete_commands
return return
fi fi
# subcommands have their own completion functions # subcommands have their own completion functions
case "$cmd" in case "${cmd}" in
<%= function_mappings.join("\n ").concat("\n") %> <%= function_mappings.join("\n ").concat("\n") %>
*) ;; *) ;;
esac esac

View File

@ -2389,32 +2389,32 @@ _brew() {
local i=1 cmd local i=1 cmd
# find the subcommand # find the subcommand
while [[ "$i" -lt "$COMP_CWORD" ]] while [[ "${i}" -lt "${COMP_CWORD}" ]]
do do
local s="${COMP_WORDS[i]}" local s="${COMP_WORDS[i]}"
case "$s" in case "${s}" in
--*) --*)
cmd="$s" cmd="${s}"
break break
;; ;;
-*) -*)
;; ;;
*) *)
cmd="$s" cmd="${s}"
break break
;; ;;
esac esac
(( i++ )) (( i++ ))
done done
if [[ "$i" -eq "$COMP_CWORD" ]] if [[ "${i}" -eq "${COMP_CWORD}" ]]
then then
__brew_complete_commands __brew_complete_commands
return return
fi fi
# subcommands have their own completion functions # subcommands have their own completion functions
case "$cmd" in case "${cmd}" in
--cache) _brew___cache ;; --cache) _brew___cache ;;
--caskroom) _brew___caskroom ;; --caskroom) _brew___caskroom ;;
--cellar) _brew___cellar ;; --cellar) _brew___cellar ;;