parse method
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
Future<void> parse(List<String> arguments) async {
_resetParser();
try {
final ParsedResult result = _parse(arguments);
if (isNotNull(result.command)) {
await _launchCommand(result.command!, result.commandArguments ?? []);
} else if (result.success) {
_validate();
}
} on ArgumentError catch (e) {
if (isTrue(_app?.exitOnFailure)) {
print(e.toString());
print('');
print(usage());
exit(1);
}
rethrow;
}
}