run method
Main entry point for running a command.
Implementation
@override
Future<void> run(Iterable<String> args) async {
try {
final argsWithDefaultCommand = _addDefaultCommand(args);
final results = parse(argsWithDefaultCommand);
final showVersion = results[FlagNames.version] as bool;
if (showVersion) {
_logger.info('DCM version: $packageVersion');
return;
}
if (!(results[FlagNames.disableMessage] as bool)) {
_logger.info(warningPen('''
This package is entering the deprecation process and will be fully discontinued on July 16th.
You can read more in this blog post https://dcm.dev/blog/2023/06/06/announcing-dcm-free-version-sunset/.
We are grateful to you for being a DCM user. If you are a DCM contributor, you can apply for a special license, feel free to reach out to info@dcm.dev.
If you think DCM is valuable and it helps you, please consider to upgrade to the new Individuals or Teams version.
To hide this message pass the 'disable-sunset-warning' option.
'''));
}
await super.run(argsWithDefaultCommand);
} on UsageException catch (e) {
_logger
..info(e.message)
..info(e.usage);
exit(64);
} on Exception catch (e) {
_logger.error('Oops; metrics has exited unexpectedly: "$e"');
exit(1);
}
await _checkForUpdates();
exit(0);
}