JAL-629 Clarify sections of arguments with --help-all (or multiple --help-...)
[jalview.git] / src / jalview / bin / argparser / Arg.java
index 8003245..ae01c48 100644 (file)
@@ -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<Arg> 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();