Skip to content

Commit

Permalink
feat(cli): Update environment command outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Oct 13, 2024
1 parent 70ad4f7 commit f4af874
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
13 changes: 6 additions & 7 deletions apps/cli/src/commands/environment/get.environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
Expand Down
20 changes: 10 additions & 10 deletions apps/cli/src/commands/environment/list.environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit f4af874

Please sign in to comment.