+ sb.append("(");
+ sb.append(String.join("; ", options));
+ sb.append(')');
+ sb.append(System.lineSeparator());
+ }
+ }
+
+ public static String argDisplayString(Arg a)
+ {
+ StringBuilder argSb = new StringBuilder();
+ argSb.append(
+ a.hasOption(Opt.BOOLEAN) ? booleanArgString(a) : a.argString());
+ if (a.hasOption(Opt.STRING))
+ argSb.append("=value");
+ return argSb.toString();
+ }
+
+ public static boolean appendArgAndDescription(StringBuilder sb,
+ String aString, String description, Arg a, int maxArgLength)
+ {
+ return appendArgAndDescription(sb, aString, description, a,
+ maxArgLength, Platform.consoleWidth());
+ }
+
+ public static boolean appendArgAndDescription(StringBuilder sb,
+ String aString, String description, Arg a, int maxArgLength,
+ int maxLength)
+ {
+ if (aString == null && a != null)
+ {
+ aString = argDisplayString(a);
+ }
+ if (description == null && a != null)
+ {
+ description = a.getDescription();
+ }
+ sb.append(String.format("%-" + maxArgLength + "s", aString));
+ if (aString.length() > maxArgLength)
+ {
+ sb.append(System.lineSeparator());
+ sb.append(String.format("%-" + maxArgLength + "s", ""));
+ }