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 {
final client = _apiClientFrom(argResults!);
try {
final entries = await client.audit();
if (entries.isEmpty) {
stdout.writeln('no audited actions yet');
return;
}
// Local time, seconds precision: an ISO instant with microseconds is 27
// characters of mostly noise, and it ran into the next column.
stdout.writeln('AT PRINCIPAL ACTION');
for (final e in entries) {
final at = e.at.toLocal().toString().split('.').first;
final target = e.target == null ? '' : ' ${e.target}';
stdout.writeln(
'${at.padRight(20)} ${e.principal.padRight(13)}'
'${e.action}$target (${e.outcome.name})',
);
}
} finally {
client.close();
}
}