executionMode static method

ExecutionMode executionMode(
  1. List<String> arguments,
  2. ExecutionMode configured
)

Implementation

static ExecutionMode executionMode(
  List<String> arguments,
  ExecutionMode configured,
) {
  final values = CliTestSelection.values(arguments, '--mode');
  if (values.length > 1) {
    throw StateError('--mode may be specified only once.');
  }
  if (values.isEmpty) return configured;
  return switch (values.single) {
    'widget' => ExecutionMode.widget,
    'integration' => ExecutionMode.integration,
    _ => throw StateError(
        'Invalid --mode="${values.single}". Use widget or integration.',
      ),
  };
}