in tool/stats.dart [22:84]
Future<void> main(List<String> args) async {
final parser = ArgParser()
..addOption('section',
help: 'Restrict tests to one section, provided after the option.')
..addFlag('raw',
defaultsTo: false, help: 'raw JSON format', negatable: false)
..addFlag('update-files',
defaultsTo: false,
help: 'Update stats files in $toolDir',
negatable: false)
..addFlag('verbose',
defaultsTo: false,
help: 'Print details for failures and errors.',
negatable: false)
..addFlag('verbose-loose',
defaultsTo: false,
help: 'Print details for "loose" matches.',
negatable: false)
..addOption('flavor', allowed: _configs.map((c) => c.prefix))
..addFlag('help', defaultsTo: false, negatable: false);
ArgResults options;
try {
options = parser.parse(args);
} on FormatException catch (e) {
stderr.writeln(e);
print(parser.usage);
exitCode = 64; // unix standard improper usage
return;
}
if (options['help'] as bool) {
print(parser.usage);
return;
}
var specifiedSection = options['section'] as String;
var raw = options['raw'] as bool /*!*/;
var verbose = options['verbose'] as bool /*!*/;
var verboseLooseMatch = options['verbose-loose'] as bool /*!*/;
var updateFiles = options['update-files'] as bool /*!*/;
if (updateFiles && (raw || verbose || (specifiedSection != null))) {
stderr.writeln('The `update-files` flag must be used by itself');
print(parser.usage);
exitCode = 64; // unix standard improper usage
return;
}
var testPrefix = options['flavor'] as String;
if (!updateFiles) {
testPrefix = _configs.first.prefix;
}
final testPrefixes =
testPrefix == null ? _configs.map((c) => c.prefix) : <String>[testPrefix];
for (var testPrefix in testPrefixes) {
await _processConfig(testPrefix, raw, updateFiles, verbose,
specifiedSection, verboseLooseMatch);
}
}