Avoid re-defining #formula?
This commit is contained in:
parent
3a4243742f
commit
3ea76b8498
@ -55,9 +55,15 @@ module Homebrew
|
|||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def build_from_source? = false
|
def build_from_source? = false
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def cask? = false
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def force_bottle? = false
|
def force_bottle? = false
|
||||||
|
|
||||||
|
# Defined in extend/os:
|
||||||
|
# def formula; end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def HEAD? = false
|
def HEAD? = false
|
||||||
|
|
||||||
@ -122,9 +128,9 @@ module Homebrew
|
|||||||
|
|
||||||
sig { returns(T.nilable(Symbol)) }
|
sig { returns(T.nilable(Symbol)) }
|
||||||
def only_formula_or_cask
|
def only_formula_or_cask
|
||||||
if invoke_if_respond_to(:formula?) && !invoke_if_respond_to(:cask?)
|
if formula? && !cask?
|
||||||
:formula
|
:formula
|
||||||
elsif invoke_if_respond_to(:cask?) && !invoke_if_respond_to(:formula?)
|
elsif cask? && !formula?
|
||||||
:cask
|
:cask
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -393,10 +393,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
unless ignore_invalid_options
|
unless ignore_invalid_options
|
||||||
unless @is_dev_cmd
|
validate_options unless @is_dev_cmd
|
||||||
set_default_options
|
|
||||||
validate_options
|
|
||||||
end
|
|
||||||
check_constraint_violations
|
check_constraint_violations
|
||||||
check_named_args(named_args)
|
check_named_args(named_args)
|
||||||
end
|
end
|
||||||
@ -416,9 +413,6 @@ module Homebrew
|
|||||||
@args
|
@args
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { void }
|
|
||||||
def set_default_options; end
|
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def validate_options; end
|
def validate_options; end
|
||||||
|
|
||||||
|
|||||||
@ -9,15 +9,9 @@ module OS
|
|||||||
|
|
||||||
requires_ancestor { Homebrew::CLI::Parser }
|
requires_ancestor { Homebrew::CLI::Parser }
|
||||||
|
|
||||||
sig { void }
|
|
||||||
def set_default_options
|
|
||||||
args.define_singleton_method(:formula?) { true } if args.respond_to?(:formula?)
|
|
||||||
end
|
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def validate_options
|
def validate_options
|
||||||
return unless args.respond_to?(:cask?)
|
return unless args.cask?
|
||||||
return unless T.unsafe(args).cask?
|
|
||||||
|
|
||||||
# NOTE: We don't raise an error here because we don't want
|
# NOTE: We don't raise an error here because we don't want
|
||||||
# to print the help page or a stack trace.
|
# to print the help page or a stack trace.
|
||||||
|
|||||||
@ -2,3 +2,12 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "extend/os/linux/cli/parser" if OS.linux?
|
require "extend/os/linux/cli/parser" if OS.linux?
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
module CLI
|
||||||
|
class Args
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def formula? = OS.linux?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user