.withOption(options)
.withOption(commands)
.withMinimum(0)
.create();
HelpFormatter hf = new HelpFormatter();
StringBuffer sep = new StringBuffer(hf.getPageWidth());
while (sep.length() < hf.getPageWidth()) {
sep.append("-");
}
hf.setHeader("File Vault version 1.0");
hf.setDivider(sep.toString());
hf.setShellCommand("vlt [options] <command> [arg1 [arg2 [arg3] ..]]");
hf.setGroup(main);
//hf.setHeader("bla bla version vla");
//displayHelp();
hf.getFullUsageSettings().removeAll(DisplaySetting.ALL);
//hf.getDisplaySettings().add(DisplaySetting.DISPLAY_PARENT_ARGUMENT);
//hf.getDisplaySettings().add(DisplaySetting.DISPLAY_PARENT_CHILDREN);
//hf.getFullUsageSettings().remove(DisplaySetting.DISPLAY_OPTIONAL);
hf.getFullUsageSettings().remove(DisplaySetting.DISPLAY_GROUP_ARGUMENT);
hf.getFullUsageSettings().remove(DisplaySetting.DISPLAY_GROUP_EXPANDED);
hf.getDisplaySettings().remove(DisplaySetting.DISPLAY_GROUP_ARGUMENT);
hf.getDisplaySettings().remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
hf.getDisplaySettings().add(DisplaySetting.DISPLAY_OPTIONAL);
//hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_PROPERTY_OPTION);
//hf.getLineUsageSettings().remove(DisplaySetting.DISPLAY_GROUP_ARGUMENT);
//hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_GROUP_NAME);
//hf.getLineUsageSettings().remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
//hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_GROUP_ARGUMENT);
//hf.getLineUsageSettings().remove(DisplaySetting.DISPLAY_GROUP_EXPANDED);
//hf.getLineUsageSettings().remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
//hf.getLineUsageSettings().remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_PROPERTY_OPTION);
hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_PARENT_ARGUMENT);
hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_ARGUMENT_BRACKETED);
Parser parser = new Parser();
parser.setHelpFormatter(hf);
parser.setGroup(main);
System.out.println(main);
CommandLine cl = parser.parseAndHelp(args);
if (cl != null) {
if (exit.execute(null, cl)) {
System.out.println("exit executed");
} else if (help.execute(null, cl)) {
System.out.println("help executed.");
} else {
hf.print();
}
}
}