private boolean isInPlaceRequired() {
return !isOutFileOption() && !isDestinationDirOption() && !isOutputStdout();
}
public Options parse() {
OptionsBuilder optionsBuilder = OptionsBuilder.options();
AttributesBuilder attributesBuilder = AttributesBuilder.attributes();
optionsBuilder.backend(this.backend).safe(this.safeMode).docType(this.doctype).eruby(this.eruby);
if (isOutFileOption() && !isOutputStdout()) {
optionsBuilder.toFile(new File(this.outFile));
}
if (isOutFileOption() && isOutputStdout()) {
optionsBuilder.toFile(false);
}
if (this.safe) {
optionsBuilder.safe(SafeMode.SAFE);
}
if (this.noHeaderFooter) {
optionsBuilder.headerFooter(false);
}
if (this.sectionNumbers) {
attributesBuilder.sectionNumbers(this.sectionNumbers);
}
if (this.compact) {
optionsBuilder.compact(this.compact);
}
if (isBaseDirOption()) {
optionsBuilder.baseDir(new File(this.baseDir));
}
if (isTemplateEngineOption()) {
optionsBuilder.templateEngine(this.templateEngine);
}
if (isTemplateDirOption()) {
for (String templateDir : this.templateDir) {
optionsBuilder.templateDir(new File(templateDir));
}
}
if (isDestinationDirOption() && !isOutputStdout()) {
optionsBuilder.toDir(new File(this.destinationDir));
}
if (isInPlaceRequired()) {
optionsBuilder.inPlace(true);
}
if (this.verbose) {
optionsBuilder.option(MONITOR_OPTION_NAME, new HashMap<Object, Object>());
}
attributesBuilder.attributes(getAttributes());
optionsBuilder.attributes(attributesBuilder.get());
return optionsBuilder.get();
}