Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Trying new possible ways to format help text
Browse files Browse the repository at this point in the history
  • Loading branch information
bamandel committed Jun 28, 2017
1 parent fe0d145 commit 63b3423
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ class HelpPrinter {
printStream.println(StringUtils.join(helpMessagePieces, System.getProperty("line.separator")))
}

private String formatColumns2(List<String> columns, int... columnWidths) {
StringBuilder sb = new StringBuilder()

String test = ''
columnWidths.each { test += "%-${it}s " }

def tlll = [
StringUtils.center(columns.get(0), 20),
StringUtils.center(columns.get(1), 20),
StringUtils.center(columns.get(2), 20)
]

sb.append(String.format(
test.trim(),
tlll.toArray()
))

sb.toString()
}

private String formatColumns(List<String> columns, int... columnWidths) {
StringBuilder createColumns = new StringBuilder()
List<String> columnfirstRow = []
Expand Down

0 comments on commit 63b3423

Please sign in to comment.