Merge pull request #14344 from apainintheneck/allow-cask-switch-for-dev-cmds-on-linux

Allow --cask for linux dev cmds
This commit is contained in:
Kevin 2023-01-09 21:33:04 -08:00 committed by GitHub
commit dbf0e28f6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -122,8 +122,9 @@ module Homebrew
@args = Homebrew::CLI::Args.new
# Filter out Sorbet runtime type checking method calls.
@command_name = caller_locations.select { |location| location.path.exclude?("/gems/sorbet-runtime-") }
.second.label.chomp("_args").tr("_", "-")
cmd_location = caller_locations.select { |location| location.path.exclude?("/gems/sorbet-runtime-") }.second
@command_name = cmd_location.label.chomp("_args").tr("_", "-")
@is_dev_cmd = cmd_location.absolute_path.start_with?(Commands::HOMEBREW_DEV_CMD_PATH)
@constraints = []
@conflicts = []
@ -329,10 +330,11 @@ module Homebrew
remaining + non_options
end
set_default_options
unless ignore_invalid_options
validate_options
unless @is_dev_cmd
set_default_options
validate_options
end
check_constraint_violations
check_named_args(named_args)
end

View File

@ -577,6 +577,14 @@ describe Homebrew::CLI::Parser do
.and not_to_output.to_stdout
.and raise_exception SystemExit
end
# Developers want to be able to use `audit` and `bump`
# commands for formulae and casks on Linux.
it "succeeds for developer commands" do
require "dev-cmd/cat"
args = Homebrew.cat_args.parse(["--cask", "cask_name"])
expect(args.cask?).to be(true)
end
end
context "with conflicting --formula switch" do