runWithOutput method

  1. @override
Future<void> runWithOutput(
  1. Configuration<DeploymentsShowOption> commandConfig,
  2. CommandOutput output
)
override

Runs this command with prepared configuration and output.

Subclasses should override this method.

Implementation

@override
Future<void> runWithOutput(
  final Configuration<DeploymentsShowOption> commandConfig,
  final CommandOutput output,
) async {
  final projectId = commandConfig.value(DeploymentsShowOption.projectId);
  final inUtc = commandConfig.value(DeploymentsShowOption.utc);
  final wait = commandConfig.value(DeploymentsShowOption.wait);
  final deploymentArg = commandConfig.optionalValue(
    DeploymentsShowOption.deploy,
  );
  final overallStatus = commandConfig.value(
    DeploymentsShowOption.overallStatus,
  );

  if (wait && !overallStatus) {
    await DeploymentCommands.tailDeployment(
      runner.serviceProvider.cloudApiClient,
      logger: logger,
      baseCommand: baseCommand,
      commandNames: _commandNames,
      projectId: projectId,
      deploymentArg: deploymentArg,
    );
    return;
  }

  await renderCommand(
    output,
    operation: () => DeploymentCommands.fetchDeploymentStatus(
      runner.serviceProvider.cloudApiClient,
      baseCommand: baseCommand,
      commandNames: _commandNames,
      projectId: projectId,
      deploymentArg: deploymentArg,
    ),
    textOutputUi: DeploymentShowTextUi(
      utc: inUtc,
      overallStatus: overallStatus,
    ),
  );
}