Show message when developer mode is turned on
This commit is contained in:
parent
41b0bf7bbb
commit
5649d339d7
@ -93,6 +93,13 @@ begin
|
||||
internal_cmd ||= begin
|
||||
internal_dev_cmd = Commands.valid_internal_dev_cmd?(cmd)
|
||||
if internal_dev_cmd && !Homebrew::EnvConfig.developer?
|
||||
opoo <<~MESSAGE if ENV["HOMEBREW_DEV_CMD_RUN"].blank?
|
||||
#{Tty.bold}#{cmd}#{Tty.reset} is a developer command, so
|
||||
Homebrew's developer mode has been automatically turned on.
|
||||
To turn developer mode off, run #{Tty.bold}brew developer off#{Tty.reset}
|
||||
|
||||
MESSAGE
|
||||
|
||||
Homebrew::Settings.write "devcmdrun", true
|
||||
ENV["HOMEBREW_DEV_CMD_RUN"] = "1"
|
||||
end
|
||||
|
||||
@ -81,6 +81,30 @@ ohai() {
|
||||
fi
|
||||
}
|
||||
|
||||
opoo() {
|
||||
if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stderr is a tty.
|
||||
then
|
||||
echo -ne "\\033[4;33mWarning\\033[0m: " >&2 # highlight Warning with underline and yellow color
|
||||
else
|
||||
echo -n "Warning: " >&2
|
||||
fi
|
||||
if [[ $# -eq 0 ]]
|
||||
then
|
||||
cat >&2
|
||||
else
|
||||
echo "$*" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
bold() {
|
||||
if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stderr is a tty.
|
||||
then
|
||||
echo -e "\\033[1m""$*""\\033[0m"
|
||||
else
|
||||
echo "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
onoe() {
|
||||
if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stderr is a tty.
|
||||
then
|
||||
@ -621,6 +645,15 @@ elif [[ -f "${HOMEBREW_LIBRARY}/Homebrew/dev-cmd/${HOMEBREW_COMMAND}.sh" ]]
|
||||
then
|
||||
if [[ -z "${HOMEBREW_DEVELOPER}" ]]
|
||||
then
|
||||
if [[ -z "${HOMEBREW_DEV_CMD_RUN}" ]]
|
||||
then
|
||||
message="$(bold ${HOMEBREW_COMMAND}) is a developer command, so
|
||||
Homebrew's developer mode has been automatically turned on.
|
||||
To turn developer mode off, run $(bold "brew developer off")
|
||||
"
|
||||
opoo "${message}"
|
||||
fi
|
||||
|
||||
git config --file="${HOMEBREW_GIT_CONFIG_FILE}" --replace-all homebrew.devcmdrun true 2>/dev/null
|
||||
export HOMEBREW_DEV_CMD_RUN="1"
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user