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() async {
  final groupId = argResults?['group-id'] as String?;
  final client = container.read(projectServiceClientProvider);

  if (groupId != null && groupId.isNotEmpty) {
    final projects = await client.getProjectsByGroup(
      GroupId(id: groupId),
      options: getCallOptions(),
    );
    printOutput(projects);
  } else {
    final projects = await client.getAllProjects(
      Empty(),
      options: getCallOptions(),
    );
    printOutput(projects);
  }
  return 0;
}