runWithConfig method
Runs this command with prepared configuration (options). Subclasses should override this method.
Implementation
@override
Future<void> runWithConfig(
final Configuration<ListEnvCommandConfig> commandConfig) async {
final projectId = commandConfig.value(ListEnvCommandConfig.projectId);
final apiCloudClient = runner.serviceProvider.cloudApiClient;
late List<EnvironmentVariable> environmentVariables;
try {
environmentVariables = await apiCloudClient.environmentVariables.list(
projectId,
);
} on Exception catch (e, s) {
throw FailureException.nested(
e, s, 'Failed to list environment variables');
}
final tablePrinter = TablePrinter();
tablePrinter.addHeaders(['Name', 'Value']);
for (var variable in environmentVariables) {
tablePrinter.addRow([variable.name, variable.value]);
}
tablePrinter.writeLines(logger.line);
}