run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<int> run() => withApp((app) async {
final client = Redis.connection(_connection(this));
try {
final masters = await client.masterClients();
final report = <String, Object?>{
'connection': client.config.redacted,
'masters': {
for (final master in masters)
'${master.config.host}:${master.config.port}': {
for (final MapEntry(:key, :value) in parseRedisInfo(
await master.command(['INFO']),
).entries)
if (_fields.contains(key)) key: value,
},
},
'client': client.stats,
};
stdout.writeln(const JsonEncoder.withIndent(' ').convert(report));
return 0;
} on RedisConnectionException catch (error) {
stderr.writeln(error.message);
return 1;
}
});