Commits

Sam Adams  committed b195e70

Reformatted basic usage instructions

  • Participants
  • Parent commits 38ba668

Comments (0)

Files changed (1)

File client-cli/src/main/java/net/chempound/client/cli/ChempoundClientCLI.java

 import net.chempound.client.cli.options.GlobalOptions;
 import net.chempound.client.cli.types.URIConverter;
 
+import java.util.Formatter;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
     }
 
     protected void displayUsageAndExit() {
-        jCommander.usage();
+        basicUsage();
         exit(1);
     }
 
     }
 
     protected void basicUsage() {
-        System.out.println("Chempound CLI");
+        System.out.println("Chempound Client CLI");
         System.out.println();
         System.out.println("basic commands:");
         System.out.println();
-        for (Map.Entry<String,JCommander> e : jCommander.getCommands().entrySet()) {
-            System.out.println(e.getKey());
+
+        final int maxLen = getMaxCommandLength();
+        for (final String command : jCommander.getCommands().keySet()) {
+            System.out.printf(" %-"+maxLen+"s   %s%n", command, jCommander.getCommandDescription(command));
         }
+
         System.out.println();
         System.out.println("use \"chempound help\" for the full list of commands");
     }
 
+    private int getMaxCommandLength() {
+        int max = -1;
+        for (String command : commands.keySet()) {
+            max = Math.max(max, command.length());
+        }
+        return max;
+    }
+
+
 }