runWithConfig method

  1. @override
Future<void> runWithConfig(
  1. Configuration<SetVariableCommandConfig> commandConfig
)
override

Runs this command with prepared configuration (options). Subclasses should override this method.

Implementation

@override
Future<void> runWithConfig(
  final Configuration<SetVariableCommandConfig> commandConfig,
) 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 VariableCommands.setVariable(
    runner.serviceProvider.cloudApiClient,
    logger: logger,
    baseCommand: baseCommand,
    projectId: projectId,
    name: variableName,
    value: valueToSet,
    secret: secretFlag,
  );
}