cli/args: Make build_from_source public instance method

This commit is contained in:
Gautham G 2020-04-12 19:12:16 +05:30
parent 2bdbca1280
commit b05c72b98b
3 changed files with 9 additions and 8 deletions

View File

@ -12,6 +12,7 @@ module Homebrew
def initialize(argv:)
super
@argv = argv
@cmdline_args = argv
@args_parsed = false
@processed_options = []
end
@ -166,6 +167,12 @@ module Homebrew
formulae.any? { |args_f| args_f.full_name == f.full_name }
end
def build_from_source
return true if args_parsed && (build_from_source? || s?)
cmdline_args.include?("--build-from-source") || cmdline_args.include?("-s")
end
private
def downcased_unique_named
@ -208,12 +215,6 @@ module Homebrew
cmdline_args.include?("--build-bottle")
end
def build_from_source
return true if args_parsed && (build_from_source? || s?)
cmdline_args.include?("--build-from-source") || cmdline_args.include?("-s")
end
def spec(default = :stable)
if head
:head

View File

@ -259,7 +259,7 @@ module Homebrew
end
def option_passed?(name)
@args.respond_to?(name) || @args.respond_to?("#{name}?")
@args[name.to_sym] || @args["#{name}?".to_sym]
end
def wrap_option_desc(desc)

View File

@ -86,7 +86,7 @@ module Homebrew
end
def args
@args ||= CLI::Args.new(argv: ARGV)
@args ||= CLI::Args.new(argv: ARGV_WITHOUT_MONKEY_PATCHING)
end
def messages