use of org.rundeck.toolbelt.format.yaml.snakeyaml.YamlFormatter in project rundeck-cli by rundeck.
the class Main method configYamlFormat.
private static void configYamlFormat(final ToolBelt belt, final RdClientConfig config) {
DumperOptions dumperOptions = new DumperOptions();
dumperOptions.setDefaultFlowStyle("BLOCK".equalsIgnoreCase(config.getString("RD_YAML_FLOW", "BLOCK")) ? DumperOptions.FlowStyle.BLOCK : DumperOptions.FlowStyle.FLOW);
dumperOptions.setPrettyFlow(config.getBool("RD_YAML_PRETTY", true));
Representer representer = new Representer();
representer.addClassTag(JobItem.class, Tag.MAP);
representer.addClassTag(ScheduledJobItem.class, Tag.MAP);
representer.addClassTag(DateInfo.class, Tag.MAP);
representer.addClassTag(Execution.class, Tag.MAP);
belt.formatter(new YamlFormatter(DataOutputAsFormatable, new Yaml(representer, dumperOptions)));
belt.channels().infoEnabled(false);
belt.channels().warningEnabled(false);
belt.channels().errorEnabled(false);
}
Aggregations