parseCommandLineOptions method

  1. @override
StringSeq parseCommandLineOptions(
  1. String prefix,
  2. StringSeq options
)
override

Convert a sequence of command-line options into properties. All options that begin with --prefix. are converted into properties. If the prefix is empty, all options that begin with -- are converted to properties. @param prefix The property prefix, or an empty string to convert all options starting with --. @param options The command-line options. @return The command-line options that do not start with the specified prefix, in their original order.

Implementation

@override
StringSeq parseCommandLineOptions(String prefix, StringSeq options) {
  var pfx = prefix;
  if (pfx.isNotEmpty && pfx.endsWith('.')) {
    pfx += '.';
  }
  pfx = '--$pfx';

  var result = <String>[];
  options.forEach((opt) {
    if (opt.contains(pfx)) {
      if (!opt.contains('=')) {
        opt += '=1';
      }

      _parseLine(opt.substring(2));
    } else {
      result.add(opt);
    }
  });
  return result;
}