output: express environment variables consistently

This commit is contained in:
Eric Knibbe 2025-08-02 23:27:59 -04:00
parent 9e4bedad2f
commit 6255263b51
No known key found for this signature in database
42 changed files with 87 additions and 81 deletions

View File

@ -180,7 +180,7 @@ module Homebrew
<<~EOS
Your shell has been configured to use a build environment from your `Brewfile`.
This should help you build stuff.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
When done, type `exit`.
EOS
end

View File

@ -32,7 +32,7 @@ module Cask
def self.all(eval_all: false)
if !eval_all && !Homebrew::EnvConfig.eval_all?
raise ArgumentError, "Cask::Cask#all cannot be used without `--eval-all` or HOMEBREW_EVAL_ALL"
raise ArgumentError, "Cask::Cask#all cannot be used without `--eval-all` or `HOMEBREW_EVAL_ALL=1`"
end
# Load core casks from tokens so they load from the API when the core cask is not tapped.

View File

@ -248,7 +248,7 @@ on_request: true)
raise CaskError, <<~EOS
Cask '#{@cask}' does not have a sha256 checksum defined and was not installed.
This means you have the #{Formatter.identifier("--require-sha")} option set, perhaps in your HOMEBREW_CASK_OPTS.
This means you have the #{Formatter.identifier("--require-sha")} option set, perhaps in your `$HOMEBREW_CASK_OPTS`.
EOS
end
@ -703,9 +703,9 @@ on_request: true)
dep_full_name = cask_or_formula.full_name
error_message = "The installation of #{@cask} has a dependency #{dep_full_name}\n" \
"from the #{dep_tap} tap but #{owner} "
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env?
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env?
error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env?
error_message << ".#{owner_contact}"
raise CaskCannotBeInstalledError.new(@cask, error_message)
@ -717,9 +717,9 @@ on_request: true)
error_message = "The installation of #{@cask.full_name} has the tap #{cask_tap}\n" \
"but #{owner} "
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless cask_tap.allowed_by_env?
error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless cask_tap.allowed_by_env?
error_message << " and\n" if !cask_tap.allowed_by_env? && cask_tap.forbidden_by_env?
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if cask_tap.forbidden_by_env?
error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if cask_tap.forbidden_by_env?
error_message << ".#{owner_contact}"
raise CaskCannotBeInstalledError.new(@cask, error_message)

View File

@ -258,8 +258,8 @@ module Homebrew
return if Homebrew::EnvConfig.no_env_hints?
return if Homebrew::EnvConfig.no_install_cleanup?
puts "Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP."
puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)."
puts "Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`."
puts "Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`)."
end
def self.puts_no_install_cleanup_disable_message_if_not_already!
@ -315,8 +315,8 @@ module Homebrew
end
if ENV["HOMEBREW_AUTOREMOVE"].present?
opoo "HOMEBREW_AUTOREMOVE is now a no-op as it is the default behaviour. " \
"Set HOMEBREW_NO_AUTOREMOVE=1 to disable it."
opoo "`$HOMEBREW_AUTOREMOVE` is now a no-op as it is the default behaviour. " \
"Set `HOMEBREW_NO_AUTOREMOVE=1` to disable it."
end
Cleanup.autoremove(dry_run: dry_run?) unless Homebrew::EnvConfig.no_autoremove?

View File

@ -130,7 +130,7 @@ module Homebrew
opoo <<~EOS
`brew deps` is not the actual runtime dependencies because #{not_using_runtime_dependencies_reason}!
This means dependencies may differ from a formula's declared dependencies.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
EOS
end

View File

@ -49,7 +49,7 @@ module Homebrew
if search_type.present?
if !args.eval_all? && Homebrew::EnvConfig.no_install_from_api?
raise UsageError, "`brew desc --search` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!"
raise UsageError, "`brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!"
end
query = args.named.join(" ")

View File

@ -63,7 +63,9 @@ module Homebrew
files["00.tap.out"] = { content: tap }
end
odie "`brew gist-logs` requires HOMEBREW_GITHUB_API_TOKEN to be set!" if GitHub::API.credentials_type == :none
if GitHub::API.credentials_type == :none
odie "`brew gist-logs` requires `$HOMEBREW_GITHUB_API_TOKEN` to be set!"
end
# Description formatted to work well as page title when viewing gist
descr = if formula.core_formula?

View File

@ -50,7 +50,7 @@ module Homebrew
taps = if args.no_named?
unless args.eval_all?
raise UsageError, "`brew readall` needs a tap or `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!"
raise UsageError, "`brew readall` needs a tap or `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!"
end
Tap.installed

View File

@ -72,7 +72,7 @@ module Homebrew
if args.desc?
if !args.eval_all? && Homebrew::EnvConfig.no_install_from_api?
raise UsageError, "`brew search --desc` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!"
raise UsageError, "`brew search --desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!"
end
Search.search_descriptions(string_or_regex, args)

View File

@ -78,8 +78,8 @@ module Homebrew
end
if ENV["HOMEBREW_AUTOREMOVE"].present?
opoo "HOMEBREW_AUTOREMOVE is now a no-op as it is the default behaviour. " \
"Set HOMEBREW_NO_AUTOREMOVE=1 to disable it."
opoo "`$HOMEBREW_AUTOREMOVE` is now a no-op as it is the default behaviour. " \
"Set `HOMEBREW_NO_AUTOREMOVE=1` to disable it."
end
Cleanup.autoremove unless Homebrew::EnvConfig.no_autoremove?
end

View File

@ -56,7 +56,7 @@ module Homebrew
if Homebrew::EnvConfig.core_git_remote != HOMEBREW_CORE_DEFAULT_GIT_REMOTE
opoo <<~EOS
HOMEBREW_CORE_GIT_REMOTE was set: #{Homebrew::EnvConfig.core_git_remote}.
`$HOMEBREW_CORE_GIT_REMOTE` was set: #{Homebrew::EnvConfig.core_git_remote}.
It has been unset for the migration.
You may need to change this from a linuxbrew-core mirror to a homebrew-core one.
@ -66,7 +66,7 @@ module Homebrew
if Homebrew::EnvConfig.bottle_domain != HOMEBREW_BOTTLE_DEFAULT_DOMAIN
opoo <<~EOS
HOMEBREW_BOTTLE_DOMAIN was set: #{Homebrew::EnvConfig.bottle_domain}.
`$HOMEBREW_BOTTLE_DOMAIN` was set: #{Homebrew::EnvConfig.bottle_domain}.
It has been unset for the migration.
You may need to change this from a Linuxbrew package mirror to a Homebrew one.
@ -412,9 +412,9 @@ module Homebrew
!Homebrew::EnvConfig.automatically_set_no_install_from_api?
return unless no_install_from_api_set
ohai "You have HOMEBREW_NO_INSTALL_FROM_API set"
ohai "You have `$HOMEBREW_NO_INSTALL_FROM_API` set"
puts "Homebrew >=4.1.0 is dramatically faster and less error-prone when installing"
puts "from the JSON API. Please consider unsetting HOMEBREW_NO_INSTALL_FROM_API."
puts "from the JSON API. Please consider unsetting `$HOMEBREW_NO_INSTALL_FROM_API`."
puts "This message will only be printed once."
puts "\n\n"

View File

@ -52,6 +52,8 @@ homebrew-update-reset() {
if [[ -z "${REPOS[*]}" ]]
then
# HOMEBREW_REPOSITORY is set by bin/brew
# shellcheck disable=SC2154
REPOS+=("${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*)
fi
@ -71,7 +73,7 @@ homebrew-update-reset() {
echo
ohai "Resetting ${DIR}..."
# HOMEBREW_* variables here may all set by bin/brew or the user
# HOMEBREW_* variables here may all be set by bin/brew or the user
# shellcheck disable=SC2154
if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" &&
(-n "${HOMEBREW_UPDATE_TO_TAG}" ||

View File

@ -650,9 +650,9 @@ EOS
if [[ -z "${HOMEBREW_NO_ENV_HINTS}" && -z "${HOMEBREW_AUTO_UPDATE_SECS}" ]]
then
# shellcheck disable=SC2016
echo 'Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with' >&2
echo 'Adjust how often this is run with `$HOMEBREW_AUTO_UPDATE_SECS` or disable with' >&2
# shellcheck disable=SC2016
echo 'HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).' >&2
echo '`$HOMEBREW_NO_AUTO_UPDATE=1`. Hide these hints with `$HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).' >&2
fi
else
ohai 'Updating Homebrew...' >&2

View File

@ -123,7 +123,7 @@ module Homebrew
eval_all = args.eval_all?
if !args.installed? && !eval_all
raise UsageError, "`brew uses` needs `--installed` or `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!"
raise UsageError, "`brew uses` needs `--installed` or `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!"
end
if show_formulae_and_casks || args.formula?

View File

@ -143,7 +143,7 @@ module Homebrew
unless eval_all
# This odisabled should probably stick around indefinitely.
odisabled "brew audit",
"brew audit --eval-all or HOMEBREW_EVAL_ALL"
"`brew audit --eval-all` or set `HOMEBREW_EVAL_ALL=1`"
end
no_named_args = true
[

View File

@ -117,7 +117,7 @@ module Homebrew
else
raise UsageError,
"`brew bump` without named arguments needs `--installed` or `--eval-all` passed or " \
"`$HOMEBREW_EVAL_ALL` set!"
"`HOMEBREW_EVAL_ALL=1` set!"
end
if args.start_with

View File

@ -22,7 +22,7 @@ module Homebrew
env: :eval_all
switch "--dependents",
description: "Determine runners for testing dependents. " \
"Requires `--eval-all` or `$HOMEBREW_EVAL_ALL` to be set.",
"Requires `--eval-all` or `HOMEBREW_EVAL_ALL=1` to be set.",
depends_on: "--eval-all"
named_args max: 2

View File

@ -109,10 +109,10 @@ module Homebrew
return if args.setup?
odie "HOMEBREW_NO_ANALYTICS is set!" if ENV["HOMEBREW_NO_ANALYTICS"]
odie "`$HOMEBREW_NO_ANALYTICS` is set!" if ENV["HOMEBREW_NO_ANALYTICS"]
token = ENV.fetch("HOMEBREW_INFLUXDB_TOKEN", nil)
odie "No InfluxDB credentials found in HOMEBREW_INFLUXDB_TOKEN!" unless token
odie "No InfluxDB credentials found in `$HOMEBREW_INFLUXDB_TOKEN`!" unless token
client = InfluxDBClient3.new(
token:,
@ -203,7 +203,7 @@ module Homebrew
client.query(query:, language: "sql").to_batches
rescue PyCall::PyError => e
if e.message.include?("message: unauthenticated")
odie "Could not authenticate with InfluxDB! Please check your HOMEBREW_INFLUXDB_TOKEN!"
odie "Could not authenticate with InfluxDB! Please check your `$HOMEBREW_INFLUXDB_TOKEN`!"
end
raise
end

View File

@ -481,7 +481,7 @@ module Homebrew
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
if Homebrew::EnvConfig.disable_load_formula?
opoo "Can't check if updated bottles are necessary as HOMEBREW_DISABLE_LOAD_FORMULA is set!"
opoo "Can't check if updated bottles are necessary as `$HOMEBREW_DISABLE_LOAD_FORMULA` is set!"
break
end
begin

View File

@ -55,7 +55,7 @@ module Homebrew
gem and pip will ignore our configuration and insist on using the
environment they were built under (mostly). Sadly, scons will also
ignore our configuration.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
When done, type `exit`.
EOS
end

View File

@ -68,7 +68,7 @@ module Homebrew
eval_all = args.eval_all?
if args.total? && !eval_all
raise UsageError, "`brew unbottled --total` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!"
raise UsageError, "`brew unbottled --total` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!"
end
if args.named.blank?
@ -116,7 +116,7 @@ module Homebrew
formulae = all_formulae = args.named.to_formulae
elsif args.dependents?
unless eval_all
raise UsageError, "`brew unbottled --dependents` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!"
raise UsageError, "`brew unbottled --dependents` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!"
end
formulae = all_formulae = Formula.all(eval_all:)

View File

@ -475,7 +475,7 @@ module Homebrew
which resolves to: #{HOMEBREW_CELLAR.realpath}
The recommended Homebrew installations are either:
(A) Have Cellar be a real directory inside of your HOMEBREW_PREFIX
(A) Have Cellar be a real directory inside of your `$HOMEBREW_PREFIX`
(B) Symlink "bin/brew" into your prefix, but don't symlink "Cellar".
Older installations of Homebrew may have created a symlinked Cellar, but this can

View File

@ -609,7 +609,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
if Homebrew::EnvConfig.no_insecure_redirect? &&
url.start_with?("https://") && !resolved_url.start_with?("https://")
$stderr.puts "HTTPS to HTTP redirect detected and HOMEBREW_NO_INSECURE_REDIRECT is set."
$stderr.puts "HTTPS to HTTP redirect detected and `$HOMEBREW_NO_INSECURE_REDIRECT` is set."
raise CurlDownloadStrategyError, url
end

View File

@ -331,9 +331,9 @@ end
class TapCoreRemoteMismatchError < TapRemoteMismatchError
def message
<<~EOS
Tap #{name} remote does not match HOMEBREW_CORE_GIT_REMOTE.
Tap #{name} remote does not match `$HOMEBREW_CORE_GIT_REMOTE`.
#{expected_remote} != #{actual_remote}
Please set HOMEBREW_CORE_GIT_REMOTE="#{actual_remote}" and run `brew update` instead.
Please set `HOMEBREW_CORE_GIT_REMOTE="#{actual_remote}"` and run `brew update` instead.
EOS
end
end

View File

@ -381,8 +381,8 @@ module Kernel
unless silent
opoo <<~EOS
Using #{editor} because no editor was set in the environment.
This may change in the future, so we recommend setting EDITOR
or HOMEBREW_EDITOR to your preferred text editor.
This may change in the future, so we recommend setting `$EDITOR`
or `$HOMEBREW_EDITOR` to your preferred text editor.
EOS
end

View File

@ -37,7 +37,7 @@ module OS
message + <<~EOS
If you don't have administrative privileges on this machine,
create a directory and set the HOMEBREW_TEMP environment variable,
create a directory and set the `$HOMEBREW_TEMP` environment variable,
for example:
install -d -m 1755 ~/tmp
#{Utils::Shell.set_variable_in_profile("HOMEBREW_TEMP", "~/tmp")}
@ -53,7 +53,7 @@ module OS
<<~EOS
The directory #{HOMEBREW_TEMP} does not permit executing
programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP
programs. It is likely mounted as "noexec". Please set `$HOMEBREW_TEMP`
in your #{Utils::Shell.profile} to a different directory, for example:
export HOMEBREW_TEMP=~/tmp
echo 'export HOMEBREW_TEMP=~/tmp' >> #{Utils::Shell.profile}
@ -148,7 +148,7 @@ module OS
return unless Homebrew::EnvConfig.bottle_domain.include?("linuxbrew")
<<~EOS
Your HOMEBREW_BOTTLE_DOMAIN still contains "linuxbrew".
Your `$HOMEBREW_BOTTLE_DOMAIN` still contains "linuxbrew".
You must unset it (or adjust it to not contain linuxbrew
e.g. by using homebrew instead).
EOS

View File

@ -1973,7 +1973,7 @@ class Formula
sig { params(source: Pathname, target: Pathname).returns(String) }
def rpath(source: bin, target: lib)
unless target.to_s.start_with?(HOMEBREW_PREFIX)
raise "rpath `target` should only be used for paths inside HOMEBREW_PREFIX!"
raise "rpath `target` should only be used for paths inside `$HOMEBREW_PREFIX`!"
end
"#{loader_path}/#{target.relative_path_from(source)}"
@ -2244,7 +2244,7 @@ class Formula
sig { params(eval_all: T::Boolean).returns(T::Array[Formula]) }
def self.all(eval_all: false)
if !eval_all && !Homebrew::EnvConfig.eval_all?
raise ArgumentError, "Formula#all without `--eval-all` or HOMEBREW_EVAL_ALL"
raise ArgumentError, "Formula#all cannot be used without `--eval-all` or `HOMEBREW_EVAL_ALL=1`"
end
(core_names + tap_files).filter_map do |name_or_file|

View File

@ -277,8 +277,8 @@ class FormulaInstaller
prefix = Pathname(bottle.cellar.to_s).parent
opoo <<~EOS
Building #{formula.full_name} from source as the bottle needs:
- HOMEBREW_CELLAR: #{bottle.cellar} (yours is #{HOMEBREW_CELLAR})
- HOMEBREW_PREFIX: #{prefix} (yours is #{HOMEBREW_PREFIX})
- `HOMEBREW_CELLAR=#{bottle.cellar}` (yours is #{HOMEBREW_CELLAR})
- `HOMEBREW_PREFIX=#{prefix}` (yours is #{HOMEBREW_PREFIX})
EOS
end
return false
@ -1503,7 +1503,7 @@ on_request: installed_on_request?, options:)
This typically indicates an invalid GitHub API token.
If you have `HOMEBREW_GITHUB_API_TOKEN` set, check it is correct
If you have `$HOMEBREW_GITHUB_API_TOKEN` set, check it is correct
or unset it and instead run:
gh auth login
@ -1517,7 +1517,7 @@ on_request: installed_on_request?, options:)
The bottle for #{formula.name} could not be verified.
This typically indicates a missing GitHub API token, which you
can resolve either by setting `HOMEBREW_GITHUB_API_TOKEN` or
can resolve either by setting `$HOMEBREW_GITHUB_API_TOKEN` or
by running:
gh auth login
@ -1649,7 +1649,7 @@ on_request: installed_on_request?, options:)
if invalid_licenses.present?
opoo <<~EOS
HOMEBREW_FORBIDDEN_LICENSES contains invalid license identifiers: #{invalid_licenses.to_sentence}
`$HOMEBREW_FORBIDDEN_LICENSES` contains invalid license identifiers: #{invalid_licenses.to_sentence}
These licenses will not be forbidden. See the valid SPDX license identifiers at:
#{Formatter.url("https://spdx.org/licenses/")}
And the licenses for a formula with:
@ -1671,7 +1671,7 @@ on_request: installed_on_request?, options:)
raise CannotInstallFormulaError, <<~EOS
The installation of #{formula.name} has a dependency on #{dep.name} where all
its licenses were forbidden by #{owner} in `HOMEBREW_FORBIDDEN_LICENSES`:
its licenses were forbidden by #{owner} in `$HOMEBREW_FORBIDDEN_LICENSES`:
#{SPDX.license_expression_to_string dep_f.license}#{owner_contact}
EOS
end
@ -1682,7 +1682,7 @@ on_request: installed_on_request?, options:)
return unless SPDX.licenses_forbid_installation? formula.license, forbidden_licenses
raise CannotInstallFormulaError, <<~EOS
#{formula.name}'s licenses are all forbidden by #{owner} in `HOMEBREW_FORBIDDEN_LICENSES`:
#{formula.name}'s licenses are all forbidden by #{owner} in `$HOMEBREW_FORBIDDEN_LICENSES`:
#{SPDX.license_expression_to_string formula.license}#{owner_contact}
EOS
end
@ -1703,9 +1703,9 @@ on_request: installed_on_request?, options:)
error_message = "The installation of #{formula.name} has a dependency #{dep.name}\n" \
"from the #{dep_tap} tap but #{owner} "
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env?
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env?
error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env?
error_message << ".#{owner_contact}"
raise CannotInstallFormulaError, error_message
@ -1719,9 +1719,9 @@ on_request: installed_on_request?, options:)
error_message = "The installation of #{formula.full_name} has the tap #{formula_tap}\n" \
"but #{owner} "
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless formula_tap.allowed_by_env?
error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless formula_tap.allowed_by_env?
error_message << " and\n" if !formula_tap.allowed_by_env? && formula_tap.forbidden_by_env?
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if formula_tap.forbidden_by_env?
error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if formula_tap.forbidden_by_env?
error_message << ".#{owner_contact}"
raise CannotInstallFormulaError, error_message
@ -1751,7 +1751,7 @@ on_request: installed_on_request?, options:)
raise CannotInstallFormulaError, <<~EOS
The installation of #{formula.name} has a dependency #{dep_name}
but the #{dep_name} formula was forbidden by #{owner} in `HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact}
but the #{dep_name} formula was forbidden by #{owner} in `$HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact}
EOS
end
end
@ -1768,7 +1768,7 @@ on_request: installed_on_request?, options:)
raise CannotInstallFormulaError, <<~EOS
The installation of #{formula_name} was forbidden by #{owner}
in `HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact}
in `$HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact}
EOS
end

View File

@ -97,7 +97,7 @@ module Formulary
using PathnameWriteMkpath
def self.load_formula(name, path, contents, namespace, flags:, ignore_errors:)
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula?
raise "Formula loading disabled by `$HOMEBREW_DISABLE_LOAD_FORMULA`!" if Homebrew::EnvConfig.disable_load_formula?
require "formula"
require "ignorable"

View File

@ -38,7 +38,7 @@ module RuboCop
end
if find_node_method_by_name(body_node, :keg_only)&.source&.include?("HOMEBREW_PREFIX")
problem "`keg_only` reason should not include `HOMEBREW_PREFIX` " \
problem "`keg_only` reason should not include `$HOMEBREW_PREFIX` " \
"as it creates confusing `brew info` output."
end
end

View File

@ -90,8 +90,8 @@ module Homebrew
opoo "uid and euid do not match, using user/* instead of gui/* domain!"
end
unless Homebrew::EnvConfig.no_env_hints?
puts "Hide this warning by setting HOMEBREW_SERVICES_NO_DOMAIN_WARNING."
puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)."
puts "Hide this warning by setting `HOMEBREW_SERVICES_NO_DOMAIN_WARNING=1`."
puts "Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`)."
end
@output_warning = T.let(true, T.nilable(TrueClass))
end

View File

@ -18,7 +18,7 @@ module Homebrew
private_class_method def self.cache_dir
cache = ENV.fetch("HOMEBREW_CACHE", nil) || ENV.fetch("HOMEBREW_DEFAULT_CACHE", nil)
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty?
raise "Needs `$HOMEBREW_CACHE` or `$HOMEBREW_DEFAULT_CACHE`!" if cache.nil? || cache.empty?
File.join(cache, "bootsnap", key)
end

View File

@ -201,7 +201,9 @@ class SystemCommand
askpass_flags = ENV.key?("SUDO_ASKPASS") ? ["-A"] : []
user_flags = []
if Homebrew::EnvConfig.sudo_through_sudo_user?
raise ArgumentError, "HOMEBREW_SUDO_THROUGH_SUDO_USER set but SUDO_USER unset!" if homebrew_sudo_user.blank?
if homebrew_sudo_user.blank?
raise ArgumentError, "`$HOMEBREW_SUDO_THROUGH_SUDO_USER` set but `$SUDO_USER` unset!"
end
user_flags += ["--prompt", "Password for %p:", "-u", homebrew_sudo_user,
*askpass_flags,

View File

@ -120,7 +120,7 @@ class Tap
Set.new(allowed_tap_list.filter_map do |tap|
Tap.fetch(tap)
rescue Tap::InvalidNameError
opoo "Invalid tap name in `HOMEBREW_ALLOWED_TAPS`: #{tap}"
opoo "Invalid tap name in `$HOMEBREW_ALLOWED_TAPS`: #{tap}"
nil
end).freeze
end
@ -135,7 +135,7 @@ class Tap
Set.new(forbidden_tap_list.filter_map do |tap|
Tap.fetch(tap)
rescue Tap::InvalidNameError
opoo "Invalid tap name in `HOMEBREW_FORBIDDEN_TAPS`: #{tap}"
opoo "Invalid tap name in `$HOMEBREW_FORBIDDEN_TAPS`: #{tap}"
nil
end).freeze
end
@ -432,9 +432,9 @@ class Tap
end
error_message = "The installation of the #{full_name} was requested but #{owner}\n"
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless allowed_by_env?
error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless allowed_by_env?
error_message << " and\n" if !allowed_by_env? && forbidden_by_env?
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if forbidden_by_env?
error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if forbidden_by_env?
error_message << ".#{owner_contact}"
odie error_message

View File

@ -19,7 +19,7 @@ RSpec.describe Homebrew::Cmd::Desc do
setup_test_formula "testball"
expect { brew "desc", "--search", "testball" }
.to output(/`brew desc --search` needs `--eval-all` passed or `\$HOMEBREW_EVAL_ALL` set!/).to_stderr
.to output(/`brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!/).to_stderr
.and be_a_failure
end

View File

@ -33,7 +33,7 @@ RSpec.describe TestRunnerFormula do
expect(described_class.new(testball, eval_all: true).eval_all).to be(true)
end
it "takes the value of `HOMEBREW_EVAL_ALL` at instantiation time if not specified" do
it "takes the value of HOMEBREW_EVAL_ALL at instantiation time if not specified" do
allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true)
expect(described_class.new(testball).eval_all).to be(true)

View File

@ -323,7 +323,7 @@ RSpec.describe "Utils::Curl" do
end
describe "::curl_executable" do
it "returns `HOMEBREW_BREWED_CURL_PATH` when `use_homebrew_curl` is `true`" do
it "returns HOMEBREW_BREWED_CURL_PATH when `use_homebrew_curl` is `true`" do
expect(curl_executable(use_homebrew_curl: true)).to eq(HOMEBREW_BREWED_CURL_PATH)
end

View File

@ -170,7 +170,7 @@ module Homebrew
if Homebrew::EnvConfig.no_installed_dependents_check?
unless Homebrew::EnvConfig.no_env_hints?
opoo <<~EOS
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set: not checking for outdated
`$HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK` is set: not checking for outdated
dependents or dependents with broken linkage!
EOS
end
@ -418,8 +418,8 @@ module Homebrew
return if Homebrew::EnvConfig.no_installed_dependents_check?
return if @puts_no_installed_dependents_check_disable_message_if_not_already
puts "Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK."
puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)."
puts "Disable this behaviour by setting `HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1`."
puts "Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`)."
@puts_no_installed_dependents_check_disable_message_if_not_already = T.let(true, T.nilable(T::Boolean))
end

View File

@ -899,7 +899,7 @@ module GitHub
end
def self.count_repo_commits(nwo, user, from: nil, to: nil, max: nil)
odie "Cannot count commits, HOMEBREW_NO_GITHUB_API set!" if Homebrew::EnvConfig.no_github_api?
odie "Cannot count commits as `$HOMEBREW_NO_GITHUB_API` is set!" if Homebrew::EnvConfig.no_github_api?
author_shas = repo_commits_for_user(nwo, user, "author", from, to, max)
committer_shas = repo_commits_for_user(nwo, user, "committer", from, to, max)
@ -922,7 +922,7 @@ module GitHub
# BrewTestBot can open as many PRs as it wants.
return false if ENV["HOMEBREW_TEST_BOT_AUTOBUMP"].present?
odie "Cannot count PRs, HOMEBREW_NO_GITHUB_API set!" if Homebrew::EnvConfig.no_github_api?
odie "Cannot count PRs as `$HOMEBREW_NO_GITHUB_API` is set!" if Homebrew::EnvConfig.no_github_api?
query = <<~EOS
query($after: String) {

View File

@ -113,7 +113,7 @@ module GitHub
when :env_token
require "utils/formatter"
<<~EOS
HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check:
`$HOMEBREW_GITHUB_API_TOKEN` may be invalid or expired; check:
#{Formatter.url("https://github.com/settings/tokens")}
EOS
when :none

View File

@ -693,7 +693,7 @@ __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l formula -l formu
__fish_brew_complete_cmd 'determine-test-runners' 'Determines the runners used to test formulae or their dependents'
__fish_brew_complete_arg 'determine-test-runners' -l all-supported -d 'Instead of selecting runners based on the chosen formula, return all supported runners'
__fish_brew_complete_arg 'determine-test-runners' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. Requires `--eval-all` or `$HOMEBREW_EVAL_ALL` to be set'
__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL=1` to be set'
__fish_brew_complete_arg 'determine-test-runners' -l eval-all -d 'Evaluate all available formulae, whether installed or not, to determine testing dependents. Enabled by default if `$HOMEBREW_EVAL_ALL` is set'
__fish_brew_complete_arg 'determine-test-runners' -l help -d 'Show this message'
__fish_brew_complete_arg 'determine-test-runners' -l quiet -d 'Make some output more quiet'

View File

@ -875,7 +875,7 @@ _brew_determine_test_runners() {
_arguments \
'(--dependents)--all-supported[Instead of selecting runners based on the chosen formula, return all supported runners]' \
'--debug[Display any debugging information]' \
'(--all-supported)--dependents[Determine runners for testing dependents. Requires `--eval-all` or `$HOMEBREW_EVAL_ALL` to be set]' \
'(--all-supported)--dependents[Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL=1` to be set]' \
'--eval-all[Evaluate all available formulae, whether installed or not, to determine testing dependents. Enabled by default if `$HOMEBREW_EVAL_ALL` is set]' \
'--help[Show this message]' \
'--quiet[Make some output more quiet]' \