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