cli/parser: Casks can be specified with --cask or --casks
This commit is contained in:
parent
8881ea74b5
commit
1ce6a38730
@ -301,7 +301,7 @@ module Homebrew
|
|||||||
# If we accept formula options, but the command isn't scoped only
|
# If we accept formula options, but the command isn't scoped only
|
||||||
# to casks, parse once allowing invalid options so we can get the
|
# to casks, parse once allowing invalid options so we can get the
|
||||||
# remaining list containing formula names.
|
# remaining list containing formula names.
|
||||||
if @formula_options && argv.exclude?("--cask")
|
if @formula_options && !only_casks?(argv)
|
||||||
remaining, non_options = parse_remaining(argv, ignore_invalid_options: true)
|
remaining, non_options = parse_remaining(argv, ignore_invalid_options: true)
|
||||||
|
|
||||||
argv = [*remaining, "--", *non_options]
|
argv = [*remaining, "--", *non_options]
|
||||||
@ -640,6 +640,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end.compact.uniq(&:name)
|
end.compact.uniq(&:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def only_casks?(argv)
|
||||||
|
argv.include?("--casks") || argv.include?("--cask")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class OptionConstraintError < UsageError
|
class OptionConstraintError < UsageError
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user