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 me = await client.get('/whoami') as Map;
final roles = (me['roles'] as List).cast<String>();
stdout.writeln('principal: ${me['principal']}');
stdout.writeln(
'roles: ${roles.isEmpty ? '(none)' : roles.join(', ')}',
);
if (me['authenticated'] != true) {
stdout.writeln('note: the API is not gated (no --api-token).');
}
} finally {
client.close();
}
}