Merge pull request #6939 from Homebrew/argv-cleanup-8

ARGV: Replaces usages of ARGV.force? with Homebrew.args.force?
This commit is contained in:
Gautham Goli 2020-01-15 21:25:36 +05:30 committed by GitHub
commit de9295cc7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -33,10 +33,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