blob: 2930dead69715d064db277c4bae714e22784ff55 [file] [log] [blame]
/*
* Copyright (c) 2005, Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innoopract - initial API and implementation
*/
package bug2html;
/**
* Parser for Commandline-Options of BugFetcher.
* @see bug2html.BugFetcher
* @author Elias Volanakis <evolanakis@innoopract.de>
*/
class BugFetcherOptions {
private boolean emptyMilestones = false;
private String[] versions = new String[0];
private String outputFileName;
private boolean helpWanted = false;
BugFetcherOptions(final String[] args) {
parseParameters(args);
}
private void parseParameters(final String[] args) {
for (int i = 0; i < args.length; i++) {
String param = args[i];
if ("--help".equals(param)) {
helpWanted = true;
}
if ("--with-empty-milestones".equals(param)) {
emptyMilestones = true;
} else if (param.startsWith("--version=")) {
String versionStr = param.substring(param.indexOf('=') + 1);
versions = versionStr.split(",");
}
}
}
void printUsage() {
String[] usage = { "Usage: java bug2html.BugFetcher [parameters]", "",
"Retrieves bugzilla enchancements of the Webtools Project into an",
"XML-File suitable as input for bug2html.xsl", "",
"Optional parameters:",
"--with-empty-milestones Include entries with empty (---) Milestones",
"--version=<versionId> Include only entries with given versionId",
" Multiple version Ids can be separated by ','",
" e.g. --version=1.0,1.1",
"--help Shows usage help", "", "Example:",
"java bug2html.BugFetcher --version=1.0,1.1 --with-empty-milestones" };
for (int i = 0; i < usage.length; i++) {
System.out.println(usage[i]);
}
}
String[] getVersions() {
return versions;
}
boolean isEmptyMilestones() {
return emptyMilestones;
}
boolean isHelpWanted() {
return helpWanted;
}
String getOutputFileName() {
return outputFileName;
}
}