Class: SimpleCovMcp::Commands::TotalsCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- SimpleCovMcp::Commands::TotalsCommand
- Defined in:
- lib/simplecov_mcp/commands/totals_command.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
#cli, #config, #source_formatter
Instance Method Summary collapse
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from SimpleCovMcp::Commands::BaseCommand
Instance Method Details
#execute(args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/simplecov_mcp/commands/totals_command.rb', line 10 def execute(args) unless args.empty? raise UsageError.for_subcommand('totals') end presenter = Presenters::ProjectTotalsPresenter.new( model: model, check_stale: (config.staleness == :error), tracked_globs: config.tracked_globs ) payload = presenter.absolute_payload return if maybe_output_structured_format?(payload, model) lines = payload['lines'] files = payload['files'] # Table format headers = ['Metric', 'Total', 'Covered', 'Uncovered', '%'] rows = [ [ 'Lines', lines['total'].to_s, lines['covered'].to_s, lines['uncovered'].to_s, format('%.2f%%', payload['percentage']) ], [ 'Files', files['total'].to_s, files['ok'].to_s, files['stale'].to_s, '' ] ] puts TableFormatter.format( headers: headers, rows: rows, alignments: [:left, :right, :right, :right, :right] ) end |