Skip to content

Commit

Permalink
Merge pull request #18027 from Homebrew/make-brew-typecheck-work-with…
Browse files Browse the repository at this point in the history
…-taps
  • Loading branch information
MikeMcQuaid authored Aug 19, 2024
2 parents 3426911 + 4e37436 commit a2a92fa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Library/Homebrew/dev-cmd/typecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a2a92fa

Please sign in to comment.