From f4af874e4811a5c11bd93ad1645564b24513b5ad Mon Sep 17 00:00:00 2001 From: rajdip-b Date: Sun, 13 Oct 2024 21:04:50 +0530 Subject: [PATCH] feat(cli): Update environment command outputs --- .../commands/environment/get.environment.ts | 13 ++++++------ .../commands/environment/list.environment.ts | 20 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/apps/cli/src/commands/environment/get.environment.ts b/apps/cli/src/commands/environment/get.environment.ts index d05e7b0d..96a0fbaa 100644 --- a/apps/cli/src/commands/environment/get.environment.ts +++ b/apps/cli/src/commands/environment/get.environment.ts @@ -38,18 +38,17 @@ export class GetEnvironment extends BaseCommand { success, error, data: environment - } = await ControllerInstance - .getInstance() - .environmentController.getEnvironment( + } = await ControllerInstance.getInstance().environmentController.getEnvironment( { slug: environmentSlug }, this.headers ) if (success) { - Logger.info('Environment fetched successfully:') - Logger.info( - `Environment Slug: ${environment.slug}, Name: ${environment.name}, Description: ${environment.description}` - ) + Logger.info(`Name: ${environment.name}`) + Logger.info(`Slug: ${environment.slug}`) + Logger.info(`Description: ${environment.description}`) + Logger.info(`Created On: ${environment.createdAt}`) + Logger.info(`Updated On: ${environment.updatedAt}`) } else { Logger.error(`Error fetching environment: ${error.message}`) } diff --git a/apps/cli/src/commands/environment/list.environment.ts b/apps/cli/src/commands/environment/list.environment.ts index c1cddc60..4bc14c3e 100644 --- a/apps/cli/src/commands/environment/list.environment.ts +++ b/apps/cli/src/commands/environment/list.environment.ts @@ -40,19 +40,19 @@ export class ListEnvironment extends BaseCommand { Logger.info('Fetching all environments...') - const { data: environments, error, success } = await ControllerInstance - .getInstance() - .environmentController.getAllEnvironmentsOfProject( - { projectSlug, ...options }, - this.headers - ) + const { + data: environments, + error, + success + } = await ControllerInstance.getInstance().environmentController.getAllEnvironmentsOfProject( + { projectSlug, ...options }, + this.headers + ) if (success) { Logger.info('Fetched environments:') - environments.items.forEach((environment) => { - Logger.info( - `- ID: ${environment.id}, Name: ${environment.name}, Description: ${environment.description}` - ) + environments.items.forEach((environment: any) => { + Logger.info(`- ${environment.name} (${environment.slug})`) }) } else { Logger.error(`Failed to fetch environments: ${error.message}`)