run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
FutureOr run() async {
final commands = argResults?.rest ?? [];
if (commands.length > 1) {
output.error('Many commands!');
return;
}
if (commands.isEmpty) {
output.error('Please, use \'slidy run --help\'');
return;
}
final command = commands.first;
final schema = argResults?['schema'] ?? 'slidy.yaml';
final fileSchema = File(schema);
final result = await loader(fileSchema) //
.flatMap((pipeline) => executeScript(command, pipeline))
.mapLeft((l) => l.message)
.run();
result.fold(output.error, output.success);
}