run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<int> run() async {
final argResults = this.argResults!;
if (validateTlsArgs(cert: _certPath, key: _keyPath, fs: fs)
case final error?) {
logger.err(error);
return 1;
}
final recompile = argResults['recompile'] as bool;
final skipIfFresh = argResults['skip-if-fresh'] as bool;
late final bool shouldRunConstructs;
try {
shouldRunConstructs = await _generator.generate(
recompile: recompile,
skipIfFresh: skipIfFresh,
);
} catch (e) {
logger
..detail('Error: $e')
..err('Failed to generate the construct');
return 1;
}
if (!shouldRunConstructs) {
return 0;
}
logger.write('\n');
await _generator.run(constructRunnerArgs);
return 0;
}