parse method

void parse(
  1. List<String> arguments
)

Parse the arguments list populating properties on the SmartArg class.

If Parser.exitOnFailure is set to true, this function will call exit(1) if there is a command line parsing error. It will do so only after telling the user what the error was and displaying the result of usage().

Implementation

void parse(List<String> arguments) {
  _resetParser();

  try {
    if (_parse(arguments)) {
      _validate();
    }
  } on ArgumentError catch (e) {
    if (_isTrue(_app?.exitOnFailure)) {
      print(e.toString());
      print('');
      print(usage());
      exit(1);
    }

    rethrow;
  }
}