mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Run shellcheck
on cask utils and shim scripts.
This commit is contained in:
parent
5aa0dbe1f9
commit
c2c93d1cc9
@ -7,7 +7,7 @@ pathremove() {
|
|||||||
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
|
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
export $PATHVARIABLE="$NEWPATH"
|
export "$PATHVARIABLE"="$NEWPATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -n "$HOMEBREW_MAKE" && "$HOMEBREW_MAKE" != "make" ]]
|
if [[ -n "$HOMEBREW_MAKE" && "$HOMEBREW_MAKE" != "make" ]]
|
||||||
@ -16,7 +16,8 @@ then
|
|||||||
else
|
else
|
||||||
SAVED_PATH="$PATH"
|
SAVED_PATH="$PATH"
|
||||||
pathremove "$HOMEBREW_LIBRARY/Homebrew/shims/linux/super"
|
pathremove "$HOMEBREW_LIBRARY/Homebrew/shims/linux/super"
|
||||||
export MAKE="$(which make)"
|
MAKE="$(which make)"
|
||||||
|
export MAKE
|
||||||
export PATH="$SAVED_PATH"
|
export PATH="$SAVED_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# System Ruby's mkmf on Mojave (10.14) and later require SDKROOT set to work correctly.
|
# System Ruby's mkmf on Mojave (10.14) and later require SDKROOT set to work correctly.
|
||||||
|
|
||||||
|
# Don't need shellcheck to follow the `source`.
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
||||||
|
|
||||||
try_exec_non_system "$SHIM_FILE" "$@"
|
try_exec_non_system "$SHIM_FILE" "$@"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Historically, xcrun has had various bugs, and in some cases it didn't
|
# Historically, xcrun has had various bugs, and in some cases it didn't
|
||||||
# work at all (e.g. CLT-only in the Xcode 4.3 era). This script emulates
|
# work at all (e.g. CLT-only in the Xcode 4.3 era). This script emulates
|
||||||
# it and attempts to avoid these issues.
|
# it and attempts to avoid these issues.
|
||||||
@ -27,10 +28,10 @@ arg0=$1
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
exe="/usr/bin/${arg0}"
|
exe="/usr/bin/${arg0}"
|
||||||
if [ -x "$exe" ]; then
|
if [[ -x "$exe" ]]; then
|
||||||
if [ -n "$HOMEBREW_PREFER_CLT_PROXIES" ]; then
|
if [[ -n "$HOMEBREW_PREFER_CLT_PROXIES" ]]; then
|
||||||
exec "$exe" "$@"
|
exec "$exe" "$@"
|
||||||
elif [ -z "$HOMEBREW_SDKROOT" -o ! -d "$HOMEBREW_SDKROOT" ]; then
|
elif [[ -z "$HOMEBREW_SDKROOT" || ! -d "$HOMEBREW_SDKROOT" ]]; then
|
||||||
exec "$exe" "$@"
|
exec "$exe" "$@"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -38,7 +39,7 @@ fi
|
|||||||
SUPERBIN=$(cd "${0%/*}" && pwd -P)
|
SUPERBIN=$(cd "${0%/*}" && pwd -P)
|
||||||
|
|
||||||
exe=$(/usr/bin/xcrun --find "$arg0" 2>/dev/null)
|
exe=$(/usr/bin/xcrun --find "$arg0" 2>/dev/null)
|
||||||
if [ -x "$exe" -a "${exe%/*}" != "$SUPERBIN" ]; then
|
if [[ -x "$exe" && "${exe%/*}" != "$SUPERBIN" ]]; then
|
||||||
exec "$exe" "$@"
|
exec "$exe" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ done
|
|||||||
IFS=$old_IFS
|
IFS=$old_IFS
|
||||||
|
|
||||||
echo >&2 "
|
echo >&2 "
|
||||||
Failed to execute $arg0 $@
|
Failed to execute ${arg0} ${*}
|
||||||
|
|
||||||
Xcode and/or the CLT appear to be misconfigured. Try one or both of the following:
|
Xcode and/or the CLT appear to be misconfigured. Try one or both of the following:
|
||||||
xcodebuild -license
|
xcodebuild -license
|
||||||
|
@ -9,6 +9,8 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Don't need shellcheck to follow the `source`.
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
||||||
|
|
||||||
case "$(lowercase "$SHIM_FILE")" in
|
case "$(lowercase "$SHIM_FILE")" in
|
||||||
|
@ -60,8 +60,10 @@ safe_exec() {
|
|||||||
fi
|
fi
|
||||||
if [[ "$HOMEBREW" = "print-path" ]]
|
if [[ "$HOMEBREW" = "print-path" ]]
|
||||||
then
|
then
|
||||||
local dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
local dir
|
||||||
local path="$(dirbasepath "$dir" "$arg0")"
|
dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
||||||
|
local path
|
||||||
|
path="$(dirbasepath "$dir" "$arg0")"
|
||||||
echo "$path"
|
echo "$path"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -177,13 +177,16 @@ module Homebrew
|
|||||||
files = [
|
files = [
|
||||||
HOMEBREW_BREW_FILE,
|
HOMEBREW_BREW_FILE,
|
||||||
# TODO: HOMEBREW_REPOSITORY/"completions/bash/brew",
|
# TODO: HOMEBREW_REPOSITORY/"completions/bash/brew",
|
||||||
*Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/*.sh"),
|
*HOMEBREW_LIBRARY.glob("Homebrew/*.sh"),
|
||||||
*Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/cmd/*.sh"),
|
*HOMEBREW_LIBRARY.glob("Homebrew/shims/**/*").map(&:realpath).uniq
|
||||||
*Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/utils/*.sh"),
|
.reject { |path| path.directory? || path.basename.to_s == "cc" },
|
||||||
|
*HOMEBREW_LIBRARY.glob("Homebrew/{dev-,}cmd/*.sh"),
|
||||||
|
*HOMEBREW_LIBRARY.glob("Homebrew/{cask/,}utils/*.sh"),
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
args = ["--shell=bash", "--", *files] # TODO: Add `--enable=all` to check for more problems.
|
# TODO: Add `--enable=all` to check for more problems.
|
||||||
|
args = ["--shell=bash", "--external-sources", "--", *files]
|
||||||
|
|
||||||
case output_type
|
case output_type
|
||||||
when :print
|
when :print
|
||||||
|
Loading…
x
Reference in New Issue
Block a user