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() async {
var userId = argResults?['user-id'] as String?;
final client = container.read(groupServiceClientProvider);
if (userId == null || userId.isEmpty) {
final userClient = container.read(userServiceClientProvider);
final currentUser = await userClient.getCurrentUser(
Empty(),
options: getCallOptions(),
);
userId = currentUser.id;
}
final groups = await client.getGroupsByUser(
UserId(id: userId),
options: getCallOptions(),
);
printOutput(groups);
return 0;
}