Text now splits at the end of a word
@@ -55,7 +55,7 @@ class HelpPrinter {
character = currentCharacter
}
def bodyColumns = [
- "${detectValue.getKey()}",
+ detectValue.getKey(),
detectValue.getDefaultValue(),
detectValue.getValueType().getSimpleName(),
detectValue.getDescription()
@@ -80,8 +80,16 @@ class HelpPrinter {
columnfirstRow.add(columns.get(i))
columnRemainingRows.add('')
} else {
- columnfirstRow.add(columns.get(i).substring(0, columnWidths[i]))
- columnRemainingRows.add(columns.get(i).substring(columnWidths[i]))
+ String firstRow = columns.get(i).substring(0, columnWidths[i])
+ int endOfWordIndex = firstRow.lastIndexOf(' ')
+ if (endOfWordIndex == -1) {
+ endOfWordIndex = columnWidths[i] - 1
+ columnfirstRow.add(firstRow.substring(0, endOfWordIndex) + ' ')
+ } else {
+ columnfirstRow.add(firstRow.substring(0, endOfWordIndex))
+ }
+
+ columnRemainingRows.add(columns.get(i).substring(endOfWordIndex).trim())
}
}
