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_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
# These referenced variables are set by bin/brew
# Don't need to handle a default case.
# shellcheck disable=SC2154,SC2249
# HOMEBREW_LIBRARY set by bin/brew
# shellcheck disable=SC2249,SC2154
case "$*" in
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
--repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
@ -315,6 +315,8 @@ then
fi
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"
case "$*" in

View File

@ -3,7 +3,9 @@
#: 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-items 'Casks' 's|/Formula/|/|' '^homebrew/core'

View File

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

View File

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

View File

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

View File

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