Class ReportText
java.lang.Object
org.apache.juneau.terminal.report.ReportText
Text helpers shared by the report readers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringTruncates a string to at mostmaxchars, ending in an ellipsis when it was cut.static StringReturns the file name of a path, never the directories (warnings leave the machine).static StringRemoves ANSI escape sequences (test runners colour their messages).stripCommonDir(List<String> paths) Shortens a list of test file paths for display.
-
Method Details
-
stripAnsi
Removes ANSI escape sequences (test runners colour their messages).- Parameters:
s- The text. May benull .- Returns:
- The text without escape sequences, or an empty string for
null .
-
clip
Truncates a string to at mostmaxchars, ending in an ellipsis when it was cut.- Parameters:
s- The text. May benull .max- The maximum length, at least 1.- Returns:
- The clipped text, or an empty string for
null .
-
fileName
Returns the file name of a path, never the directories (warnings leave the machine).- Parameters:
path- The path.- Returns:
- The last segment, or an empty string.
-
stripCommonDir
Shortens a list of test file paths for display.Backslashes become slashes, then the longest common directory prefix of all paths is removed, so
/ci/work/repo/src/a.test.jsand/ci/work/repo/src/b/c.test.jsbecomea.test.jsandb/c.test.js. A list with a single path keeps its last two segments (src/a.test.js).- Parameters:
paths- The paths.- Returns:
- The display paths, in the same order.
-