parse method

void parse()

Implementation

void parse() {
  if (_parsed != null) return;
  final parsed = <String, String>{};

  final consecutive = <String>[];
  for (final flag in _flags) {
    if (flag.startsWith('-')) {
      if (consecutive.isNotEmpty) {
        parsed[consecutive.first] = consecutive.join(' ');
      }

      consecutive.clear();

      if (flag.contains('=')) {
        final split = flag.split('=');

        parsed[split.first] = flag;
        continue;
      }
    }

    consecutive.add(flag);
  }

  if (consecutive.isNotEmpty) {
    parsed[consecutive.first] = consecutive.join(' ');
  }

  _parsed = parsed;
}