@@ -40,7 +40,7 @@ public DefaultUsageFormatter(JCommander commander) {
40
40
public final void usage (String commandName ) {
41
41
StringBuilder sb = new StringBuilder ();
42
42
usage (commandName , sb );
43
- commander .getConsole ().print (sb . toString () );
43
+ commander .getConsole ().println (sb );
44
44
}
45
45
46
46
/**
@@ -153,7 +153,7 @@ public void appendMainLine(StringBuilder out, boolean hasOptions, boolean hasCom
153
153
if (commander .getMainParameter () != null && commander .getMainParameter ().getDescription () != null ) {
154
154
mainLine .append (" " ).append (commander .getMainParameter ().getDescription ().getDescription ());
155
155
}
156
- wrapDescription (out , indentCount , mainLine . toString () );
156
+ wrapDescription (out , indentCount , mainLine );
157
157
out .append ('\n' );
158
158
}
159
159
@@ -286,7 +286,7 @@ public void appendCommands(StringBuilder out, int indentCount, int descriptionIn
286
286
firstCommand = false ;
287
287
}
288
288
JCommander .ProgramName progName = commands .getKey ();
289
- String dispName = progName .getDisplayName ();
289
+ var dispName = progName .getDisplayName ();
290
290
String commandDescription = Optional .ofNullable (getCommandDescription (progName .getName ()))
291
291
.map (desc -> s (6 ) + desc )
292
292
.orElse ("" );
@@ -352,9 +352,9 @@ public String getCommandDescription(String commandName) {
352
352
* description}. If the first line needs to be indented prepend the
353
353
* correct number of spaces to {@code description}.
354
354
*/
355
- public void wrapDescription (StringBuilder out , int indent , int currentLineIndent , String description ) {
355
+ public void wrapDescription (StringBuilder out , int indent , int currentLineIndent , CharSequence description ) {
356
356
int max = commander .getColumnSize ();
357
- String [] words = description .split (" " );
357
+ String [] words = description .toString (). split (" " );
358
358
int current = currentLineIndent ;
359
359
360
360
for (int i = 0 ; i < words .length ; i ++) {
@@ -385,7 +385,7 @@ public void wrapDescription(StringBuilder out, int indent, int currentLineIndent
385
385
* correct number of spaces to {@code description}.
386
386
* @see #wrapDescription(StringBuilder, int, int, String)
387
387
*/
388
- public void wrapDescription (StringBuilder out , int indent , String description ) {
388
+ public void wrapDescription (StringBuilder out , int indent , CharSequence description ) {
389
389
wrapDescription (out , indent , 0 , description );
390
390
}
391
391
@@ -404,13 +404,13 @@ public static String getI18nString(ResourceBundle bundle, String key, String def
404
404
*
405
405
* @return count-many spaces
406
406
*/
407
- public static String s (int count ) {
407
+ public static CharSequence s (int count ) {
408
408
StringBuilder result = new StringBuilder ();
409
409
410
410
for (int i = 0 ; i < count ; i ++) {
411
411
result .append (" " );
412
412
}
413
- return result . toString () ;
413
+ return result ;
414
414
}
415
415
416
416
/**
0 commit comments