main function
The entry point of RSP compiler.
Implementation
Future main(List<String> arguments) async {
final env = _Environ();
if (!_parseArgs(arguments, env))
return;
final stats = _Stats();
Future compile(String name)
=> compileFile(name, encoding: env.encoding, verbose: env.verbose,
lineNumber: env.lineNumber, newer: env.newer,
onCompile: stats.onCompile);
for (final String name in env.sources) {
final dir = Directory(name);
if (await dir.exists()) {
await for (final fse in dir.list(recursive: true)) {
final path = fse.path;
if (path.endsWith(".rsp.html")
&& await FileSystemEntity.isFile(path)) {
try {
await compile(path);
} catch (ex, st) {
print("Unable to compile $path: $ex\n$st");
}
}
}
} else {
compile(name);
}
}
stats.printSummary();
}