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 id = JSON(argResults?['id']).int;
final index = JSON(argResults?['index']).stringValue;
final execute = Unwrap(id).map((e) => Execute.cache(e)).value;
final data = await DartOpsEngine.getRequestData(id).then((value) =>
value.map((key, value) => MapEntry(key.toString(), value.toString())));
requestArgs.addAll(data);
if (execute != null) {
await execute.saveRequestData(data, index);
}
final response = await actionRun.run(
execute?.memoryEnv ?? Env(),
requestArgs,
);
if (execute != null) {
await execute.saveResponseData(response, index);
} else {
print(JSON(response).stringValue);
}
}