CliOptions.parse constructor

CliOptions.parse(
  1. List<String> args
)

Parses the command-line args.

Positional arguments are interpreted as the paths of the Dart files to analyze. When none are provided, every Dart file under lib/ is analyzed.

Throws a FormatException when an unknown option is provided.

Implementation

factory CliOptions.parse(List<String> args) {
  final parser = _buildParser();
  final results = parser.parse(args);

  return CliOptions(
    verbose: results['verbose'] as bool,
    showHelp: results['help'] as bool,
    files: List.unmodifiable(results.rest),
    usage: _buildUsage(parser),
  );
}