listProjects static method
Future<void>
listProjects(
- Client cloudApiClient, {
- required CommandLogger logger,
- bool inUtc = false,
- bool includeArchived = false,
Implementation
static Future<void> listProjects(
final Client cloudApiClient, {
required final CommandLogger logger,
final bool inUtc = false,
final bool includeArchived = false,
}) async {
final projects = await cloudApiClient.adminProjects.listProjects(
includeArchived: includeArchived,
);
final timezoneName = inUtc ? 'UTC' : 'local';
final table = TablePrinter(
headers: [
'Project Id',
'Created at ($timezoneName)',
'Archived at ($timezoneName)',
'Owner',
'Users',
],
rows: projects.map((final p) => [
p.cloudProjectId,
p.createdAt.toTzString(inUtc, 19),
p.archivedAt?.toTzString(inUtc, 19),
p.owner?.user?.email ?? '',
_formatProjectUsers(p),
]),
);
table.writeLines(logger.line);
}