run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<void> run() async {
print("Starting...");
CompilerLogger.verbose = argResults?['verbose'] == true;
final String? targetPath = argResults?["target"];
if (targetPath == null) {
print("Error: Not target file provided");
return;
}
if (!targetPath.endsWith(".dart")) {
print("Error: Target file must be a .dart file");
return;
}
final file = File(targetPath);
final bool fileExists = await file.exists();
if (!fileExists) {
print("File not Found");
return;
}
final String projectRoot = Directory.current.path;
final compiler = RobloxCompiler(projectRoot: projectRoot);
await compiler.compileFile(file);
print("Translated!");
}