diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index fac268dd6f9bf..de22b26b1545c 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -39,11 +39,17 @@ class Typecheck < AbstractCommand conflicts "--lsp", "--update-all" conflicts "--lsp", "--fix" - named_args :none + named_args :tap end sig { override.void } def run + if (args.dir.present? || args.file.present?) && args.named.present? + raise UsageError, "Cannot use `--dir` or `--file` when specifying a tap." + elsif args.fix? && args.named.present? + raise UsageError, "Cannot use `--fix` when specifying a tap." + end + update = args.update? || args.update_all? groups = update ? Homebrew.valid_gem_groups : ["typecheck"] Homebrew.install_bundler_gems!(groups:) @@ -95,10 +101,11 @@ def run end srb_exec += ["--ignore", args.ignore] if args.ignore.present? - if args.file.present? || args.dir.present? + if args.file.present? || args.dir.present? || (tap_dir = args.named.to_paths(only: :tap).first).present? cd("sorbet") do srb_exec += ["--file", "../#{args.file}"] if args.file srb_exec += ["--dir", "../#{args.dir}"] if args.dir + srb_exec += ["--dir", tap_dir.to_s] if tap_dir end end success = system(*srb_exec)