console.info("\n See '{} help <command>' for more information on a " +
"specific command.", Main.PROGRAM_NAME);
} else {
for (String cmd : helpCommands) {
JCommander commander = jc.getCommands().get(cmd);
if (commander == null) {
console.error("Unknown command: {}", cmd);
return 1;
}
console.info("\nUsage: {} [general options] {} {} [command options]",
new Object[] {
Main.PROGRAM_NAME, cmd,
commander.getMainParameterDescription()});
console.info("\n Description:");
console.info("\n {}", jc.getCommandDescription(cmd));
if (!commander.getParameters().isEmpty()) {
console.info("\n Command options:\n");
for (ParameterDescription param : commander.getParameters()) {
hasRequired = printOption(console, param) || hasRequired;
}
if (hasRequired) {
console.info("\n * = required");
}
}
List<String> examples = ((Command) commander.getObjects().get(0)).getExamples();
if (examples != null) {
console.info("\n Examples:");
for (String example : examples) {
if (example.startsWith("#")) {
// comment