use backticks around suggested input, flags, and binaries

This commit is contained in:
EricFromCanada 2021-01-24 21:40:41 -05:00
parent cd3cb6928b
commit 2ed324ebc0
23 changed files with 36 additions and 36 deletions

View File

@ -40,7 +40,7 @@ module Cask
def run_installer(command: nil, verbose: false, **_options) def run_installer(command: nil, verbose: false, **_options)
ohai "Running installer for #{cask}; your password may be necessary.", ohai "Running installer for #{cask}; your password may be necessary.",
"Package installers may write to any location; options such as --appdir are ignored." "Package installers may write to any location; options such as `--appdir` are ignored."
unless path.exist? unless path.exist?
pkg = path.relative_path_from(cask.staged_path) pkg = path.relative_path_from(cask.staged_path)
pkgs = Pathname.glob(cask.staged_path/"**"/"*.pkg").map { |path| path.relative_path_from(cask.staged_path) } pkgs = Pathname.glob(cask.staged_path/"**"/"*.pkg").map { |path| path.relative_path_from(cask.staged_path) }

View File

@ -174,7 +174,7 @@ module Cask
[args.remaining.empty? ? NullCommand : UnknownSubcommand.new(args.remaining.first), argv] [args.remaining.empty? ? NullCommand : UnknownSubcommand.new(args.remaining.first), argv]
if (replacement = DEPRECATED_COMMANDS[command]) if (replacement = DEPRECATED_COMMANDS[command])
odisabled "brew cask #{command.command_name}", replacement odisabled "`brew cask #{command.command_name}`", replacement
end end
if args.help? if args.help?

View File

@ -482,7 +482,7 @@ module Cask
end end
def zap def zap
ohai %Q(Implied "brew uninstall --cask #{@cask}") ohai "Implied `brew uninstall --cask #{@cask}`"
uninstall_artifacts uninstall_artifacts
if (zap_stanzas = @cask.artifacts.select { |a| a.is_a?(Artifact::Zap) }).empty? if (zap_stanzas = @cask.artifacts.select { |a| a.is_a?(Artifact::Zap) }).empty?
opoo "No zap stanza present for Cask '#{@cask}'" opoo "No zap stanza present for Cask '#{@cask}'"

View File

@ -32,7 +32,7 @@ module Cask
odebug "Checking quarantine support" odebug "Checking quarantine support"
if !system_command(xattr, print_stderr: false).success? if !system_command(xattr, print_stderr: false).success?
odebug "There's not a working version of xattr." odebug "There's no working version of `xattr` on this system."
:xattr_broken :xattr_broken
elsif swift.nil? elsif swift.nil?
odebug "Swift is not available on this system." odebug "Swift is not available on this system."

View File

@ -45,7 +45,7 @@ module Homebrew
when "all" when "all"
0 0
else else
raise UsageError, "--prune= expects an integer or 'all'." raise UsageError, "`--prune=` expects an integer or `all`."
end end
end end

View File

@ -146,7 +146,7 @@ module Homebrew
if args.ignore_dependencies? if args.ignore_dependencies?
opoo <<~EOS opoo <<~EOS
#{Tty.bold}--ignore-dependencies is an unsupported Homebrew developer flag!#{Tty.reset} #{Tty.bold}`--ignore-dependencies` is an unsupported Homebrew developer flag!#{Tty.reset}
Adjust your PATH to put any preferred versions of applications earlier in the Adjust your PATH to put any preferred versions of applications earlier in the
PATH rather than using this unsupported flag! PATH rather than using this unsupported flag!

View File

@ -86,7 +86,7 @@ module Homebrew
end end
if !args.force? && (formula.blank? || !formula.keg_only_reason.versioned_formula?) if !args.force? && (formula.blank? || !formula.keg_only_reason.versioned_formula?)
opoo "#{keg.name} is keg-only and must be linked with --force" opoo "#{keg.name} is keg-only and must be linked with `--force`."
puts_keg_only_path_message(keg) puts_keg_only_path_message(keg)
next next
end end

View File

@ -28,9 +28,9 @@ module Homebrew
switch "--cask", switch "--cask",
description: "List only outdated casks." description: "List only outdated casks."
flag "--json", flag "--json",
description: "Print output in JSON format. There are two versions: v1 and v2. " \ description: "Print output in JSON format. There are two versions: `v1` and `v2`. " \
"v1 is deprecated and is currently the default if no version is specified. " \ "`v1` is deprecated and is currently the default if no version is specified. " \
"v2 prints outdated formulae and casks. " "`v2` prints outdated formulae and casks. "
switch "--fetch-HEAD", switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\ description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will only be checked for "\ "formula is outdated. Otherwise, the repository's HEAD will only be checked for "\
@ -50,7 +50,7 @@ module Homebrew
case (j = json_version(args.json)) case (j = json_version(args.json))
when :v1 when :v1
odisabled "brew outdated --json#{j == :v1 ? "=v1" : ""}", "brew outdated --json=v2" odisabled "`brew outdated --json#{j == :v1 ? "=v1" : ""}`", "`brew outdated --json=v2`"
when :v2, :default when :v2, :default
formulae, casks = if args.formula? formulae, casks = if args.formula?
[outdated_formulae(args: args), []] [outdated_formulae(args: args), []]

View File

@ -85,7 +85,7 @@ module Homebrew
puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort) puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
else else
odeprecated "'brew search' with no arguments to output formulae", "'brew formulae'" odeprecated "`brew search` with no arguments to output formulae", "`brew formulae`"
puts Formatter.columns(Formula.full_names.sort) puts Formatter.columns(Formula.full_names.sort)
end end

View File

@ -400,7 +400,7 @@ module Homebrew
end end
odie <<~EOS odie <<~EOS
--keep-old was passed but there are changes in: `--keep-old` was passed but there are changes in:
#{mismatches.join("\n")} #{mismatches.join("\n")}
EOS EOS
end end
@ -566,7 +566,7 @@ module Homebrew
def old_checksums(formula, formula_ast, bottle_hash, args:) def old_checksums(formula, formula_ast, bottle_hash, args:)
bottle_node = formula_ast.bottle_block bottle_node = formula_ast.bottle_block
if bottle_node.nil? if bottle_node.nil?
odie "--keep-old was passed but there was no existing bottle block!" if args.keep_old? odie "`--keep-old` was passed but there was no existing bottle block!" if args.keep_old?
return return
end end
return [] unless args.keep_old? return [] unless args.keep_old?
@ -576,7 +576,7 @@ module Homebrew
mismatches, checksums = merge_bottle_spec(old_keys, old_bottle_spec, bottle_hash["bottle"]) mismatches, checksums = merge_bottle_spec(old_keys, old_bottle_spec, bottle_hash["bottle"])
if mismatches.present? if mismatches.present?
odie <<~EOS odie <<~EOS
--keep-old was passed but there are changes in: `--keep-old` was passed but there are changes in:
#{mismatches.join("\n")} #{mismatches.join("\n")}
EOS EOS
end end

View File

@ -113,7 +113,7 @@ module Homebrew
if new_version.present? if new_version.present?
if new_version.latest? if new_version.latest?
opoo "Ignoring specified --sha256= argument." if new_hash.present? opoo "Ignoring specified `--sha256=` argument." if new_hash.present?
new_hash = :no_check new_hash = :no_check
elsif new_hash.nil? || cask.languages.present? elsif new_hash.nil? || cask.languages.present?
tmp_contents = Utils::Inreplace.inreplace_pairs(cask.sourcefile_path, tmp_contents = Utils::Inreplace.inreplace_pairs(cask.sourcefile_path,

View File

@ -196,7 +196,7 @@ module Homebrew
new_revision = Utils.popen_read("git -C \"#{resource_path}\" rev-parse -q --verify HEAD") new_revision = Utils.popen_read("git -C \"#{resource_path}\" rev-parse -q --verify HEAD")
new_revision = new_revision.strip new_revision = new_revision.strip
elsif new_revision.blank? elsif new_revision.blank?
odie "#{formula}: the current URL requires specifying a --revision= argument." odie "#{formula}: the current URL requires specifying a `--revision=` argument."
end end
false false
elsif new_url.blank? && new_version.blank? elsif new_url.blank? && new_version.blank?
@ -424,11 +424,11 @@ module Homebrew
return if new_mirrors.present? || old_mirrors.empty? return if new_mirrors.present? || old_mirrors.empty?
if args.force? if args.force?
opoo "#{formula}: Removing all mirrors because a --mirror= argument was not specified." opoo "#{formula}: Removing all mirrors because a `--mirror=` argument was not specified."
else else
odie <<~EOS odie <<~EOS
#{formula}: a --mirror= argument for updating the mirror URL(s) was not specified. #{formula}: a `--mirror=` argument for updating the mirror URL(s) was not specified.
Use --force to remove all mirrors. Use `--force` to remove all mirrors.
EOS EOS
end end
end end
@ -439,7 +439,7 @@ module Homebrew
resource.owner = Resource.new(formula.name) resource.owner = Resource.new(formula.name)
forced_version = new_version && new_version != resource.version forced_version = new_version && new_version != resource.version
resource.version = new_version if forced_version resource.version = new_version if forced_version
odie "No --version= argument specified!" if resource.version.blank? odie "No `--version=` argument specified!" if resource.version.blank?
[resource.fetch, forced_version] [resource.fetch, forced_version]
end end

View File

@ -61,7 +61,7 @@ module Homebrew
require "keg" require "keg"
require "cask" require "cask"
ohai "Interactive Homebrew Shell", "Example commands available with: brew irb --examples" ohai "Interactive Homebrew Shell", "Example commands available with: `brew irb --examples`"
if args.pry? if args.pry?
Pry.start Pry.start
else else

View File

@ -49,7 +49,7 @@ module Homebrew
_, user, repo, issue = *url_match _, user, repo, issue = *url_match
odie "Not a GitHub pull request: #{arg}" unless issue odie "Not a GitHub pull request: #{arg}" unless issue
if args.tap.present? && !"#{user}/#{repo}".casecmp(tap.full_name).zero? if args.tap.present? && !"#{user}/#{repo}".casecmp(tap.full_name).zero?
odie "Pull request URL is for #{user}/#{repo} but --tap=#{tap.full_name}!" odie "Pull request URL is for #{user}/#{repo} but `--tap=#{tap.full_name}` was specified!"
end end
ohai "Dispatching #{tap} pull request ##{issue}" ohai "Dispatching #{tap} pull request ##{issue}"

View File

@ -414,7 +414,7 @@ module Homebrew
workflow_run.first.blank? workflow_run.first.blank?
# Ignore that workflow as it was not executed and we specified # Ignore that workflow as it was not executed and we specified
# that we could skip it. # that we could skip it.
ohai "Ignoring workflow #{workflow} as requested by --ignore-missing-artifacts" ohai "Ignoring workflow #{workflow} as requested by `--ignore-missing-artifacts`"
next next
end end

View File

@ -129,7 +129,7 @@ module Homebrew
quiet_system "brew", "help" quiet_system "brew", "help"
# run brew update # run brew update
oh1 "Running brew update..." oh1 "Running `brew update`..."
safe_system "brew", "update", "--verbose", "--debug" safe_system "brew", "update", "--verbose", "--debug"
actual_end_commit = Utils.popen_read("git", "rev-parse", branch).chomp actual_end_commit = Utils.popen_read("git", "rev-parse", branch).chomp
if actual_end_commit != end_commit if actual_end_commit != end_commit
@ -137,7 +137,7 @@ module Homebrew
end_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", end_commit).chomp end_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", end_commit).chomp
actual_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", actual_end_commit).chomp actual_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", actual_end_commit).chomp
odie <<~EOS odie <<~EOS
brew update didn't update #{branch}! `brew update` didn't update #{branch}!
Start commit: #{start_log} Start commit: #{start_log}
Expected end commit: #{end_log} Expected end commit: #{end_log}
Actual end commit: #{actual_log} Actual end commit: #{actual_log}

View File

@ -983,7 +983,7 @@ module Homebrew
EOS EOS
end end
elsif result.stderr.include? "pkg_resources.DistributionNotFound" elsif result.stderr.include? "pkg_resources.DistributionNotFound"
"Your Python installation is unable to find xattr." "Your Python installation is unable to find `xattr`."
else else
"unknown xattr error: #{result.stderr.split("\n").last}" "unknown xattr error: #{result.stderr.split("\n").last}"
end end
@ -994,7 +994,7 @@ module Homebrew
when :quarantine_available when :quarantine_available
nil nil
when :xattr_broken when :xattr_broken
"There's not a working version of xattr." "There's no working version of `xattr` on this system."
when :no_swift when :no_swift
"Swift is not available on this system." "Swift is not available on this system."
when :no_quarantine when :no_quarantine

View File

@ -241,7 +241,7 @@ module Homebrew
HOMEBREW_NO_INSTALL_CLEANUP: { HOMEBREW_NO_INSTALL_CLEANUP: {
description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically " \ description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically " \
"cleanup installed/upgraded/reinstalled formulae or all formulae every " \ "cleanup installed/upgraded/reinstalled formulae or all formulae every " \
"HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS days.", "`HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS` days.",
boolean: true, boolean: true,
}, },
HOMEBREW_PRY: { HOMEBREW_PRY: {

View File

@ -31,7 +31,7 @@ module FormulaCellarChecks
<<~EOS <<~EOS
A top-level "man" directory was found A top-level "man" directory was found
Homebrew requires that man pages live under share. Homebrew requires that man pages live under share.
This can often be fixed by passing "--mandir=\#{man}" to configure. This can often be fixed by passing `--mandir=\#{man}` to `configure`.
EOS EOS
end end
@ -42,7 +42,7 @@ module FormulaCellarChecks
<<~EOS <<~EOS
A top-level "info" directory was found A top-level "info" directory was found
Homebrew suggests that info pages live under share. Homebrew suggests that info pages live under share.
This can often be fixed by passing "--infodir=\#{info}" to configure. This can often be fixed by passing `--infodir=\#{info}` to `configure`.
EOS EOS
end end

View File

@ -225,10 +225,10 @@ module Formulary
def load_file(flags:) def load_file(flags:)
if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?<formula_name>[\w+-.@]+).rb} =~ url # rubocop:disable Style/CaseLikeIf if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?<formula_name>[\w+-.@]+).rb} =~ url # rubocop:disable Style/CaseLikeIf
raise UsageError, "Installation of #{formula_name} from a GitHub commit URL is unsupported! " \ raise UsageError, "Installation of #{formula_name} from a GitHub commit URL is unsupported! " \
"'brew extract #{formula_name}' to stable tap on GitHub instead." "`brew extract #{formula_name}` to a stable tap on GitHub instead."
elsif url.match?(%r{^(https?|ftp)://}) elsif url.match?(%r{^(https?|ftp)://})
raise UsageError, "Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! ", raise UsageError, "Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! ",
"'brew extract' or 'brew create' and 'brew tap-new' to create a "\ "`brew extract` or `brew create` and `brew tap-new` to create a "\
"formula file in a tap on GitHub instead." "formula file in a tap on GitHub instead."
end end
HOMEBREW_CACHE_FORMULA.mkpath HOMEBREW_CACHE_FORMULA.mkpath

View File

@ -160,7 +160,7 @@ module ELFShim
def save_using_patchelf(new_interpreter, new_rpath) def save_using_patchelf(new_interpreter, new_rpath)
patchelf = DevelopmentTools.locate "patchelf" patchelf = DevelopmentTools.locate "patchelf"
odie "Could not locate patchelf, please: brew install patchelf." if patchelf.blank? odie "Could not locate `patchelf`; please run `brew install patchelf`" if patchelf.blank?
args = [] args = []
args << "--set-interpreter" << new_interpreter if new_interpreter.present? args << "--set-interpreter" << new_interpreter if new_interpreter.present?
args << "--force-rpath" << "--set-rpath" << new_rpath if new_rpath.present? args << "--force-rpath" << "--set-rpath" << new_rpath if new_rpath.present?

View File

@ -411,7 +411,7 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
"--keep-old", "--keep-old",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output("Error: --keep-old was passed but there was no existing bottle block!\n").to_stderr }.to output("Error: `--keep-old` was passed but there was no existing bottle block!\n").to_stderr
end end
it "updates the bottle block in a formula that already has a bottle block when using --keep-old" do it "updates the bottle block in a formula that already has a bottle block when using --keep-old" do

View File

@ -16,7 +16,7 @@ module Utils
which("curl"), which("curl"),
"/usr/bin/curl", "/usr/bin/curl",
].compact.map { |c| Pathname(c) }.find(&:executable?) ].compact.map { |c| Pathname(c) }.find(&:executable?)
raise "No executable curl was found" unless @curl raise "No executable `curl` was found" unless @curl
@curl @curl
end end