If the main loop did not get a subcommand during parsing of the command line then we should offer up a list of commonly used commands and their one-line usage summary, to help the user make a decision about which command they should try to execute. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../src/org/spearce/jgit/pgm/Main.java | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Main.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Main.java index c069989..c8bade8 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Main.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Main.java @@ -121,6 +121,24 @@ public class Main { System.err.println(); clp.printUsage(System.err); System.err.println(); + } else if (subcommand == null) { + System.err.println(); + System.err.println("The most commonly used commands are:"); + final CommandRef[] common = CommandCatalog.common(); + int width = 0; + for (final CommandRef c : common) + width = Math.max(width, c.getName().length()); + width += 2; + + for (final CommandRef c : common) { + System.err.print(' '); + System.err.print(c.getName()); + for (int i = c.getName().length(); i < width; i++) + System.err.print(' '); + System.err.print(c.getUsage()); + System.err.println(); + } + System.err.println(); } System.exit(1); } -- 1.6.0.rc0.182.gb96c7 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html