From 5f75f9bff16bce462ef737bacfadd3463366c5c0 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Sun, 21 May 2023 16:45:03 +0100 Subject: [PATCH] JAL-629 Clarify sections of arguments with --help-all (or multiple --help-...) --- src/jalview/bin/argparser/Arg.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/jalview/bin/argparser/Arg.java b/src/jalview/bin/argparser/Arg.java index 8003245..ae01c48 100644 --- a/src/jalview/bin/argparser/Arg.java +++ b/src/jalview/bin/argparser/Arg.java @@ -522,9 +522,9 @@ public enum Arg { StringBuilder sb = new StringBuilder(); - sb.append("usage: jalview [" + Arg.HEADLESS.argString() + "] [" + sb.append("usage: jalview [" + Arg.HEADLESS.argString() + "] [[" + Arg.OPEN.argString() + "/" + Arg.APPEND.argString() - + " file(s)] [args]"); + + "] file(s)] [args]"); sb.append(System.lineSeparator()); sb.append(System.lineSeparator()); @@ -567,6 +567,7 @@ public enum Arg } Iterator argsI = args.iterator(); + Type typeSection = null; while (argsI.hasNext()) { Arg a = argsI.next(); @@ -577,10 +578,27 @@ public enum Arg continue; } + if (a.getType() != typeSection) + { + typeSection = a.getType(); + String typeDescription = a.getType().description(); + if (typeDescription != null && typeDescription.length() > 0) + { + // typeDescription = typeDescription.substring(0, + // 1).toUpperCase(Locale.ROOT) + typeDescription.substring(1); + typeDescription = typeDescription.toUpperCase(Locale.ROOT); + sb.append(typeDescription); + sb.append(System.lineSeparator()); + sb.append(System.lineSeparator()); + } + } + appendArgUsage(sb, a, maxArgLength); if (argsI.hasNext()) + { sb.append(System.lineSeparator()); + } } } return sb.toString(); -- 1.7.10.2