run method

  1. @override
Future<int> run(
  1. Iterable<String> args
)
override

Parses args and invokes Command.run on the chosen command.

This always returns a Future in case the command is asynchronous. The Future will throw a UsageException if args was invalid.

Implementation

@override
Future<int> run(Iterable<String> args) async {
  try {
    final argResults = parse(args);
    return await runCommand(argResults) ?? 0;
  } on FormatException catch (e, stackTrace) {
    printf('err = ${e.message}, stackTrace = $stackTrace, info = $usage');
    return -1;
  } on UsageException catch (e) {
    printf('err = ${e.message}, info = ${e.usage}');
    return -1;
  }
}