rules.add(new Parameter(FLAG, CL_HELP, ZERO_OR_ONE, "-(\\?|h|help)", "Koll3ctions.usage.help"));
// -[la|latinAlphabet]
rules.add(new Parameter(FLAG, LATIN_ALPHABET, ZERO_OR_ONE, "-(la|latinAlphabet)", "Koll3ctions.usage.latinAlphabet"));
// -[d|debug]
rules.add(new Parameter(FLAG, DEBUG_MODE, ZERO_OR_ONE, "-(d|debug)", ""));
KommandLine cl = new KommandLine(rules, "Koll3ctions.usage.general", "Koll3ctions.usage.example", BUNDLE_NAME);
cl.parse(args);
String s;
boolean needHelp = false;
for (Parameter param : rules) {
String name = param.getName();
s = cl.getStringValue(name);
if (s != null) {
if (CL_SCAN.equals(name)) {
cfg.put(SCAN_AUDIBLE, FALSE);
cfg.put(SCAN_PICTURES, FALSE);
for (int i = 0; i < s.length(); i++) {
switch (s.charAt(i)) {
case 'a':
cfg.put(SCAN_AUDIBLE, TRUE);
break;
case 'p':
cfg.put(SCAN_PICTURES, TRUE);
break;
}
}
} else if (CL_HELP.equals(name)) {
needHelp = true;
} else {
cfg.put(name, s);
}
}
}
if (needHelp) {
cl.setLanguage(cfg.get(LANGUAGE));
cl.showUsage();
}
}
}