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.listProjectsInfo(
includeArchived: includeArchived,
includeLatestDeployAttemptTime: true,
);
final timezoneName = inUtc ? 'UTC' : 'local';
final table = TablePrinter(
headers: [
'Project Id',
'Created At ($timezoneName)',
'Archived At ($timezoneName)',
'Last Deploy Attempt',
'Owner',
'Users',
],
rows: projects.map((final p) => [
p.project.cloudProjectId,
p.project.createdAt.toTzString(inUtc, 19),
p.project.archivedAt?.toTzString(inUtc, 19),
p.latestDeployAttemptTime?.timestamp?.toTzString(inUtc, 19),
p.project.owner?.user?.email ?? '',
_formatProjectUsers(p.project),
]),
);
table.writeLines(logger.line);
}