# typed: strict
# frozen_string_literal: true

require "abstract_subcommand"
require "cli/parser"

Dir["#{__dir__}/subcommand/*.rb"].each do |subcommand|
  require "developer/subcommand/#{File.basename(subcommand, ".rb")}"
end

module Homebrew
  module Cmd
    class Developer < Homebrew::AbstractCommand
      class << self
        sig { params(args: T.untyped).void }
        def dispatch(args)
          subcommand_class = Homebrew::AbstractSubcommand
                             .subcommands_for(Homebrew::Cmd::Developer)
                             .find do |candidate|
            candidate.subcommand_name == args.subcommand
          end
          T.must(subcommand_class).new(args).run
        end
      end
    end
  end
end
