Merge pull request #14450 from issyl0/casks-are-not-formulae
cli/parser: Don't treat args with `--cask` as formulae
This commit is contained in:
commit
79676ad20d
@ -298,9 +298,10 @@ module Homebrew
|
||||
def parse(argv = ARGV.freeze, ignore_invalid_options: false)
|
||||
raise "Arguments were already parsed!" if @args_parsed
|
||||
|
||||
# If we accept formula options, parse once allowing invalid options
|
||||
# so we can get the remaining list containing formula names.
|
||||
if @formula_options
|
||||
# If we accept formula options, but the command isn't scoped only
|
||||
# to casks, parse once allowing invalid options so we can get the
|
||||
# remaining list containing formula names.
|
||||
if @formula_options && !only_casks?(argv)
|
||||
remaining, non_options = parse_remaining(argv, ignore_invalid_options: true)
|
||||
|
||||
argv = [*remaining, "--", *non_options]
|
||||
@ -639,6 +640,10 @@ module Homebrew
|
||||
end
|
||||
end.compact.uniq(&:name)
|
||||
end
|
||||
|
||||
def only_casks?(argv)
|
||||
argv.include?("--casks") || argv.include?("--cask")
|
||||
end
|
||||
end
|
||||
|
||||
class OptionConstraintError < UsageError
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user