run method
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 argResults = parse(args);
final int exitCode =
await runCommand(argResults) ?? ExitCode.success.code;
return exitCode;
} on SvgToFlutterException catch (e) {
stderr.writeln('\x1b[31m ❌ $e ❌');
return ExitCode.usage.code;
} on SvgToFlutterUsageException catch (e) {
stderr.writeln('\x1b[31m ❌ $e ❌');
return ExitCode.usage.code;
} on UsageException catch (e) {
stderr.writeln('\x1b[31m ❌ $e ❌');
return ExitCode.usage.code;
} on Exception catch (e) {
stderr.writeln('\x1b[31m ❌ $e ❌');
return ExitCode.usage.code;
}
}