parse method

dynamic parse(
  1. List<String> arguments
)

Implementation

parse(List<String> arguments) {
  var parser = ArgParser();
  parser.addOption('config');
  parser.addOption('port');
  this.args = parser.parse(arguments);
  var argsPort = this.args!['port'];
  if (argsPort != null) {
    if (int.tryParse(argsPort) == null || int.parse(argsPort) < 1) {
      throw new Exception('--port value must be a positive integer.');
    }
    port = int.tryParse(argsPort);
  }
}