ARGV: Replaces usages of ARGV.force? with Homebrew.args.force?

This commit is contained in:
Gautham Goli 2020-01-15 20:26:58 +05:30
parent 13f508d0dc
commit 161c3fb6a4
5 changed files with 4 additions and 8 deletions

View File

@ -185,7 +185,7 @@ module Homebrew
path = destination_tap.path/"Formula/#{name}@#{version}.rb" path = destination_tap.path/"Formula/#{name}@#{version}.rb"
if path.exist? if path.exist?
unless ARGV.force? unless Homebrew.args.force?
odie <<~EOS odie <<~EOS
Destination formula already exists: #{path} Destination formula already exists: #{path}
To overwrite it and continue anyways, run: To overwrite it and continue anyways, run:

View File

@ -52,7 +52,7 @@ module Homebrew
end end
# Don't test unlinked formulae # Don't test unlinked formulae
if !ARGV.force? && !f.keg_only? && !f.linked? if !Homebrew.args.force? && !f.keg_only? && !f.linked?
ofail "#{f.full_name} is not linked" ofail "#{f.full_name} is not linked"
next next
end end

View File

@ -45,10 +45,6 @@ module HomebrewArgvExtension
flag_with_value&.delete_prefix(arg_prefix) flag_with_value&.delete_prefix(arg_prefix)
end end
def force?
flag? "--force"
end
def verbose? def verbose?
flag?("--verbose") || !ENV["VERBOSE"].nil? || !ENV["HOMEBREW_VERBOSE"].nil? flag?("--verbose") || !ENV["VERBOSE"].nil? || !ENV["HOMEBREW_VERBOSE"].nil?
end end

View File

@ -349,7 +349,7 @@ class FormulaInstaller
end end
def check_conflicts def check_conflicts
return if ARGV.force? return if Homebrew.args.force?
conflicts = formula.conflicts.select do |c| conflicts = formula.conflicts.select do |c|
f = Formulary.factory(c.name) f = Formulary.factory(c.name)

View File

@ -108,7 +108,7 @@ class Migrator
end end
end end
def initialize(formula, force: ARGV.force?) def initialize(formula, force: Homebrew.args.force?)
@oldname = formula.oldname @oldname = formula.oldname
@newname = formula.name @newname = formula.name
raise MigratorNoOldnameError, formula unless oldname raise MigratorNoOldnameError, formula unless oldname