// Figure out the max command name and shortcut length dynamically
int maxName = 0;
int maxShortcut = 0;
iterator = shell.getRegistry().commands().iterator();
while (iterator.hasNext()) {
Command command = iterator.next();
if (command.getHidden()) {
continue;
}
if (command.getName().length() > maxName) {
maxName = command.getName().length();
}
if (command.getShortcut().length() > maxShortcut) {
maxShortcut = command.getShortcut().length();
}
}
io.out.println(clientResource.getString(Constants.RES_HELP_INFO));
io.out.println();
// List the commands we know about
io.out.println(clientResource.getString(Constants.RES_HELP_AVAIL_COMMANDS));
iterator = shell.getRegistry().commands().iterator();
while (iterator.hasNext()) {
Command command = iterator.next();
if (command.getHidden()) {
continue;
}
String paddedName =
StringUtils.rightPad(command.getName(), maxName);
String paddedShortcut =
StringUtils.rightPad(command.getShortcut(), maxShortcut);
String description = command.getDescription();
StringBuilder sb = new StringBuilder();
sb.append(" ")
.append(MessageFormat.format(clientResource.getString(Constants
.RES_HELP_CMD_DESCRIPTION), paddedName,