buildParser function

ArgParser buildParser()

Builds the argument parser for the 'report' command.

Defines all available options for generating coverage reports:

  • Input/output file paths
  • Filtering options (exclude patterns, uncovered-only, line filtering)
  • Coverage thresholds and summary mode

Returns a configured ArgParser instance for the report command.

Implementation

ArgParser buildParser() {
  return ArgParser()
    ..addFlag(
      'help',
      abbr: 'h',
      negatable: false,
      help: 'Print help for the report command.',
    )
    ..addOption(
      'input',
      abbr: 'i',
      help: 'Input LCOV file path (default: coverage/lcov.info)',
      defaultsTo: 'coverage/lcov.info',
    )
    ..addOption('output', abbr: 'o', help: 'Output file path (default: stdout)')
    ..addMultiOption(
      'exclude',
      abbr: 'e',
      help:
          'Exclude files matching pattern (glob). '
          'Can be specified multiple times.',
    )
    ..addMultiOption(
      'exclude-line',
      splitCommas: false,
      help:
          'Exclude specific lines from coverage. '
          'Format: file_path:line_number:line_content. '
          'Can be specified multiple times.',
    )
    ..addOption(
      'fail-under',
      abbr: 'f',
      help: 'Exit with error if coverage below threshold (percentage)',
    )
    ..addFlag(
      'summary',
      abbr: 's',
      negatable: false,
      help: 'Show summary with individual file coverage',
    )
    ..addFlag(
      'uncovered-only',
      negatable: false,
      help: 'Show only files with uncovered lines',
    )
    ..addFlag(
      'no-filter',
      negatable: false,
      help:
          'Disable filtering of common useless lines (@override, braces, etc.)',
    )
    ..addOption(
      'preset',
      abbr: 'p',
      help: 'Use a named preset from buggy.yaml.',
    );
}