runWithOutput method

  1. @override
Future<void> runWithOutput(
  1. Configuration<UnsetVariableCommandConfig> 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<UnsetVariableCommandConfig> commandConfig,
  final CommandOutput output,
) async {
  final projectId = commandConfig.value(UnsetVariableCommandConfig.projectId);
  final variableName = commandConfig.value(
    UnsetVariableCommandConfig.variableName,
  );

  await VariableCommands.findVariable(
    runner.serviceProvider.cloudApiClient,
    baseCommand: baseCommand,
    projectId: projectId,
    name: variableName,
  );

  await confirmToContinue(
    output,
    message:
        'Are you sure you want to remove the environment variable "$variableName"?',
    defaultValue: false,
  );

  await renderCommand(
    output,
    operation: () => VariableCommands.unsetVariable(
      runner.serviceProvider.cloudApiClient,
      baseCommand: baseCommand,
      projectId: projectId,
      name: variableName,
    ),
    textOutputUi: VariableUnsetTextUi(baseCommand: baseCommand),
  );
}