run method

  1. @override
Future<int> run()
override

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 key = argResults!.rest.firstOrNull;
  if (key == null) {
    stderr.writeln('Usage: dartisan redis:inspect <key>');
    return 64;
  }
  final report = await inspectRedisKey(
    Redis.connection(_connection(this)),
    key,
    values: !_production,
  );
  stdout.writeln(const JsonEncoder.withIndent('  ').convert(report));
  return report['exists'] == true ? 0 : 1;
});