| | |
| | | |
| | | import static com.forgerock.opendj.cli.CliMessages.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.MAX_LINE_WIDTH; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.util.StaticUtils.EOL; |
| | | import static com.forgerock.opendj.util.StaticUtils.getBytes; |
| | |
| | | |
| | | private static final String INDENT = " "; |
| | | |
| | | private static final int MAX_LENGTH = 80; |
| | | |
| | | /** |
| | | * Creates a new instance of this argument parser with no arguments. Unnamed |
| | | * trailing arguments will not be allowed. |
| | |
| | | buffer.append(EOL); |
| | | buffer.append(EOL); |
| | | if (toolDescription != null && toolDescription.length() > 0) { |
| | | buffer.append(wrapText(toolDescription.toString(), MAX_LENGTH - 1)); |
| | | buffer.append(wrapText(toolDescription.toString(), MAX_LINE_WIDTH - 1)); |
| | | buffer.append(EOL); |
| | | buffer.append(EOL); |
| | | } |
| | |
| | | final LocalizableMessage groupDesc = argGroup.getDescription(); |
| | | if (groupDesc != null && !LocalizableMessage.EMPTY.equals(groupDesc)) { |
| | | buffer.append(EOL); |
| | | buffer.append(wrapText(groupDesc.toString(), MAX_LENGTH - 1)); |
| | | buffer.append(wrapText(groupDesc.toString(), MAX_LINE_WIDTH - 1)); |
| | | buffer.append(EOL); |
| | | buffer.append(EOL); |
| | | } |
| | |
| | | } |
| | | |
| | | final int lineLength = (buffer.length() - currentLength) + newBuffer.length(); |
| | | if (lineLength > MAX_LENGTH) { |
| | | if (lineLength > MAX_LINE_WIDTH) { |
| | | buffer.append(EOL); |
| | | } |
| | | buffer.append(newBuffer); |
| | |
| | | // Write one or more lines with the description of the argument. |
| | | // We will indent the description five characters and try our best to wrap |
| | | // at or before column 79 so it will be friendly to 80-column displays. |
| | | buffer.append(wrapText(a.getDescription(), MAX_LENGTH, indentLength)); |
| | | buffer.append(wrapText(a.getDescription(), MAX_LINE_WIDTH, indentLength)); |
| | | buffer.append(EOL); |
| | | |
| | | if (a.needsValue() && a.getDefaultValue() != null && a.getDefaultValue().length() > 0) { |