This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-cli.git
The following commit(s) were added to refs/heads/master by this push: new 9830ec0 Use the same name method name as Commons Lang 9830ec0 is described below commit 9830ec0af8b5558ac524f044b54537f3b22bd721 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Oct 14 16:36:07 2024 -0400 Use the same name method name as Commons Lang --- .../commons/cli/help/TextHelpAppendable.java | 4 ++-- .../java/org/apache/commons/cli/help/Util.java | 28 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/commons/cli/help/TextHelpAppendable.java b/src/main/java/org/apache/commons/cli/help/TextHelpAppendable.java index 076fe79..b7d4a92 100644 --- a/src/main/java/org/apache/commons/cli/help/TextHelpAppendable.java +++ b/src/main/java/org/apache/commons/cli/help/TextHelpAppendable.java @@ -208,7 +208,7 @@ public class TextHelpAppendable extends FilterHelpAppendable { final int idx = Math.min(level, fillChars.length) - 1; final TextStyle style = styleBuilder.get(); final Queue<String> queue = makeColumnQueue(text, style); - queue.add(Util.createPadding(style.getLeftPad()) + Util.filledString(Math.min(text.length(), style.getMaxWidth()), fillChars[idx])); + queue.add(Util.createPadding(style.getLeftPad()) + Util.repeat(Math.min(text.length(), style.getMaxWidth()), fillChars[idx])); queue.add(BLANK_LINE); printQueue(queue); } @@ -261,7 +261,7 @@ public class TextHelpAppendable extends FilterHelpAppendable { if (!Util.isEmpty(title)) { final TextStyle style = styleBuilder.get(); final Queue<String> queue = makeColumnQueue(title, style); - queue.add(Util.createPadding(style.getLeftPad()) + Util.filledString(Math.min(title.length(), style.getMaxWidth()), '#')); + queue.add(Util.createPadding(style.getLeftPad()) + Util.repeat(Math.min(title.length(), style.getMaxWidth()), '#')); queue.add(BLANK_LINE); printQueue(queue); } diff --git a/src/main/java/org/apache/commons/cli/help/Util.java b/src/main/java/org/apache/commons/cli/help/Util.java index 593a68a..66e2794 100644 --- a/src/main/java/org/apache/commons/cli/help/Util.java +++ b/src/main/java/org/apache/commons/cli/help/Util.java @@ -33,7 +33,7 @@ final class Util { * @since 1.10.0 */ static String createPadding(final int len) { - return filledString(len, ' '); + return repeat(len, ' '); } /** @@ -48,19 +48,6 @@ final class Util { return isEmpty(str) ? defaultValue : str; } - /** - * Constructs a string of specified length filled with the specified char. - * - * @param len the length of the final string. - * @param fillChar the character to file it will. - * @return A string of specified length filled with the specified char. - */ - static String filledString(final int len, final char fillChar) { - final char[] padding = new char[len]; - Arrays.fill(padding, fillChar); - return new String(padding); - } - /** * Finds the position of the first non whitespace character. * @@ -110,6 +97,19 @@ final class Util { return pos == -1 ? "" : s.substring(pos); } + /** + * Constructs a string of specified length filled with the specified char. + * + * @param len the length of the final string. + * @param fillChar the character to file it will. + * @return A string of specified length filled with the specified char. + */ + static String repeat(final int len, final char fillChar) { + final char[] padding = new char[len]; + Arrays.fill(padding, fillChar); + return new String(padding); + } + /** * Removes the trailing whitespace from the specified String. *