ReviewCommand constructor

ReviewCommand({
  1. String name = 'review',
  2. String? repoRoot,
  3. ReviewProjectConfig? config,
  4. String? reviewDirectoryName,
  5. String? cliCommandDisplay,
  6. String? cliResolveCommand,
  7. List<String>? allowedSites,
  8. bool includeServeSubcommand = false,
  9. Future<void>? serveStopSignal,
  10. StringSink? out,
  11. StringSink? err,
})

Implementation

ReviewCommand({
  String name = 'review',
  String? repoRoot,
  ReviewProjectConfig? config,
  String? reviewDirectoryName,
  String? cliCommandDisplay,
  String? cliResolveCommand,
  List<String>? allowedSites,
  bool includeServeSubcommand = false,
  Future<void>? serveStopSignal,
  StringSink? out,
  StringSink? err,
}) : _commandName = name,
     _displayDirectory =
         reviewDirectoryName ??
         config?.reviewDirectoryName ??
         defaultReviewDirectoryName {
  final resolvedCliCommand =
      cliResolveCommand ??
      (cliCommandDisplay != null
          ? '${cliCommandDisplay.trim()} resolve'
          : config?.cliResolveCommand);
  final effectiveAllowedSites = allowedSites ?? config?.allowedSites;

  _context = ReviewExecutionContext(
    repoRoot: repoRoot,
    config: config,
    reviewDirectoryName: reviewDirectoryName,
    cliResolveCommand: resolvedCliCommand,
    allowedSites: effectiveAllowedSites,
    out: out,
    err: err,
    parentResults: () => argResults,
    globalResults: () => globalResults,
  );

  _addSiteOption(argParser, allowedSites: effectiveAllowedSites);

  if (includeServeSubcommand) {
    addSubcommand(ReviewServeCommand(_context, stopSignal: serveStopSignal));
  }
  addSubcommand(
    ReviewListCommand(_context, allowedSites: effectiveAllowedSites),
  );
  addSubcommand(
    ReviewPromptCommand(_context, allowedSites: effectiveAllowedSites),
  );
  addSubcommand(
    ReviewResolveCommand(
      _context,
      allowedSites: effectiveAllowedSites,
      displayDirectory: _displayDirectory,
    ),
  );
  addSubcommand(
    ReviewClearCommand(
      _context,
      allowedSites: effectiveAllowedSites,
      displayDirectory: _displayDirectory,
    ),
  );
}