run function
Initializes the dartle library and runs the tasks selected by the user
(or in the provided args
).
This method will normally not return as Dartle will exit with the
appropriate code. To avoid that, set doNotExit
to true
.
Implementation
Future<void> run(List<String> args,
{required Set<Task> tasks,
Set<Task> defaultTasks = const {},
bool doNotExit = false}) async {
await checkProjectInit(doNotExit);
await runSafely(args, doNotExit, (stopWatch, options) async {
if (options.showHelp) {
return print(dartleUsage);
}
if (options.showVersion) {
return print('Dartle version $dartleVersion');
}
activateLogging(options.logLevel, colorfulLog: options.colorfulLog);
await runBasic(tasks, defaultTasks, options, DartleCache.instance);
stopWatch.stop();
if (!options.showInfoOnly && options.logBuildTime) {
logger.info(ColoredLogMessage(
'✔ Build succeeded in ${elapsedTime(stopWatch)}', LogColor.green));
}
});
}