updated output format to accept 'ALL' to generated both HTML and XML reports

Former-commit-id: 002943f373d5541d0ede54d00beb9c155eb454c0
This commit is contained in:
Jeremy Long
2013-04-19 18:52:02 -04:00
parent 198d73acfa
commit 23e08c1ca1
2 changed files with 8 additions and 5 deletions

View File

@@ -112,9 +112,10 @@ public class ReportGenerator {
* reports.
*/
public void generateReports(String outputDir, String outputFormat) throws IOException, Exception {
if ("XML".equalsIgnoreCase(outputFormat)) {
if ("XML".equalsIgnoreCase(outputFormat) || "ALL".equalsIgnoreCase(outputFormat)) {
generateReport("XmlReport", outputDir + File.separator + "DependencyCheck-Report.xml");
} else {
}
if ("HTML".equalsIgnoreCase(outputFormat) || "ALL".equalsIgnoreCase(outputFormat)) {
generateReport("HtmlReport", outputDir + File.separator + "DependencyCheck-Report.html");
}
}

View File

@@ -108,8 +108,10 @@ public final class CliParser {
}
if (line.hasOption(ArgumentName.OUTPUT_FORMAT)) {
final String format = line.getOptionValue(ArgumentName.OUTPUT_FORMAT);
if (!("XML".equalsIgnoreCase(format) || "HTML".equalsIgnoreCase(format))) {
throw new ParseException("Supported output formats are XML and HTML");
if (!("ALL".equalsIgnoreCase(format)
|| "XML".equalsIgnoreCase(format)
|| "HTML".equalsIgnoreCase(format))) {
throw new ParseException("Supported output formats are XML, HTML, or ALL");
}
}
}
@@ -187,7 +189,7 @@ public final class CliParser {
.create(ArgumentName.OUT_SHORT);
final Option outputformat = OptionBuilder.withArgName("format").hasArg().withLongOpt(ArgumentName.OUTPUT_FORMAT)
.withDescription("the output format to write to.")
.withDescription("the output format to write to (XML, HTML, ALL).")
.create(ArgumentName.OUTPUT_FORMAT_SHORT);
//TODO add the ability to load a properties file to override the defaults...