run method

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

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.whoami();
    stdout.writeln('principal: ${me.principal}');
    stdout.writeln(
      'roles:     ${me.roles.isEmpty ? '(none)' : me.roles.join(', ')}',
    );
    if (!me.authenticated) {
      stdout.writeln('note:      the API is not gated (no --api-token).');
    }
  } finally {
    client.close();
  }
}