blob: 6606483c12d9c5126fa7bc32130dbb02486ccde7 [file] [log] [blame]
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'package:args/args.dart';
class BaselineOptions {
late final bool dryRun;
late final List<String> builders;
late final Map<String, String> configs;
late final List<String> channels;
late final String target;
BaselineOptions(List<String> arguments) {
var parser = ArgParser();
abbr: 'c',
allowed: ['main', 'dev', 'beta', 'stable'],
defaultsTo: ['main'],
help: 'a comma separated list of channels');
abbr: 'm',
help: 'a comma separated list of configuration mappings in the form:'
abbr: 'b',
help: 'a comma separated list of builders to read result data from');
abbr: 't', help: 'a the name of the builder to baseline');
abbr: 'n',
defaultsTo: false,
help: 'prevents writes and only processes a single result',
negatable: false);
abbr: 'h', negatable: false, help: 'prints this message');
var parsed = parser.parse(arguments);
if (parsed['help'] ||
parsed['builders'] is! List<String> ||
parsed['target'] is! String) {
builders = (parsed['builders'] as List<String>);
configs = {
for (var v in ((parsed['config-mapping'] as Iterable<String>)
.map((c) => c.split(':'))))
v[0]: v[1]
dryRun = parsed['dry-run'];
channels = parsed['channel'];
target = parsed['target'];