runWithOutput method

  1. @override
Future<void> runWithOutput(
  1. Configuration<SetVariableCommandConfig> 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<SetVariableCommandConfig> commandConfig,
  final CommandOutput output,
) async {
  final projectId = commandConfig.value(SetVariableCommandConfig.projectId);
  final variableName = commandConfig.value(
    SetVariableCommandConfig.variableName,
  );
  final valueToSet = commandConfig.valueOrFileContent(
    value: SetVariableCommandConfig.variableValue,
    valueFile: SetVariableCommandConfig.valueFile,
  );
  final secretFlag = commandConfig.optionalValue(
    SetVariableCommandConfig.secret,
  );

  await renderCommand(
    output,
    operation: () => VariableCommands.setVariable(
      runner.serviceProvider.cloudApiClient,
      baseCommand: baseCommand,
      projectId: projectId,
      name: variableName,
      value: valueToSet,
      secret: secretFlag,
    ),
    textOutputUi: VariableSetTextUi(baseCommand: baseCommand),
  );
}