use of org.embulk.command.PreviewPrinter in project embulk by embulk.
the class EmbulkRunner method previewInternal.
private void previewInternal(final ConfigSource configSource, final String format) throws IOException {
final PreviewResult previewResult = this.embed.preview(configSource);
final ModelManager modelManager = this.embed.getModelManager();
final PreviewPrinter printer;
switch(format != null ? format : "table") {
case "table":
printer = new TablePreviewPrinter(System.out, modelManager, previewResult.getSchema());
break;
case "vertical":
printer = new VerticalPreviewPrinter(System.out, modelManager, previewResult.getSchema());
break;
default:
throw new IllegalArgumentException("Unknown preview output format '" + format + "'. Supported formats: table, vertical");
}
printer.printAllPages(previewResult.getPages());
printer.finish();
}
Aggregations