runWithConfig method
Runs this command with prepared configuration (options). Subclasses should override this method.
Implementation
@override
Future<void> runWithConfig(
final Configuration<DeleteVariableCommandConfig> commandConfig,
) async {
final projectId = commandConfig.value(
DeleteVariableCommandConfig.projectId,
);
final variableName = commandConfig.value(
DeleteVariableCommandConfig.variableName,
);
final shouldDelete = await logger.confirm(
'Are you sure you want to delete the environment variable "$variableName"?',
defaultValue: false,
);
if (!shouldDelete) {
throw UserAbortException();
}
final apiCloudClient = runner.serviceProvider.cloudApiClient;
try {
await apiCloudClient.environmentVariables.delete(
name: variableName,
cloudCapsuleId: projectId,
);
} on Exception catch (e, s) {
throw FailureException.nested(
e,
s,
'Failed to delete the environment variable',
);
}
logger.success('Successfully deleted environment variable: $variableName.');
}