Class: SimpleCovMcp::Commands::CommandFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov_mcp/commands/command_factory.rb

Constant Summary collapse

COMMAND_MAP =
{
  'list' => ListCommand,
  'version' => VersionCommand,
  'summary' => SummaryCommand,
  'raw' => RawCommand,
  'uncovered' => UncoveredCommand,
  'detailed' => DetailedCommand,
  'totals' => TotalsCommand,
  'total' => TotalsCommand, # Alias for backward compatibility
  'validate' => ValidateCommand
}.freeze

Class Method Summary collapse

Class Method Details

.available_commandsObject



40
41
42
# File 'lib/simplecov_mcp/commands/command_factory.rb', line 40

def self.available_commands
  COMMAND_MAP.keys
end

.create(command_name, cli_context) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/simplecov_mcp/commands/command_factory.rb', line 28

def self.create(command_name, cli_context)
  command_class = COMMAND_MAP[command_name]
  unless command_class
    raise UsageError.for_subcommand(
      'list | summary <path> | raw <path> | uncovered <path> | detailed <path> ' \
        '| totals | validate <file> | validate -i <code> | version'
    )
  end

  command_class.new(cli_context)
end