< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java

Print this page
rev 47329 : 8189102: All tools should support -?, -h and --help

@@ -71,11 +71,11 @@
     private String vmIdString;
 
     private VmIdentifier vmId;
 
     public static void printUsage(PrintStream ps) {
-        ps.println("Usage: jstat -help|-options");
+        ps.println("Usage: jstat --help|-options");
         ps.println("       jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]");
         ps.println();
         ps.println("Definitions:");
         ps.println("  <option>      An option reported by the -options option");
         ps.println("  <vmid>        Virtual Machine Identifier. A vmid takes the following form:");

@@ -91,20 +91,22 @@
         ps.println("                    <n>[\"ms\"|\"s\"]");
         ps.println("                Where <n> is an integer and the suffix specifies the units as ");
         ps.println("                milliseconds(\"ms\") or seconds(\"s\"). The default units are \"ms\".");
         ps.println("  <count>       Number of samples to take before terminating.");
         ps.println("  -J<flag>      Pass <flag> directly to the runtime system.");
+        ps.println("  -? -h --help  Prints this help message.");
 
         // undocumented options:
         //   -list [<vmid>]  - list counter names
         //   -snap <vmid>    - snapshot counter values as name=value pairs
         //   -name <pattern> - output counters matching given pattern
         //   -a              - sort in ascending order (default)
         //   -d              - sort in descending order
         //   -v              - verbose output  (-snap)
         //   -constants      - output constants with -name output
         //   -strings        - output strings with -name output
+        //   -help           - same as -? ...
     }
 
     private static int toMillis(String s) throws IllegalArgumentException {
 
         String[] unitStrings = { "ms", "s" }; // ordered from most specific to

@@ -145,10 +147,13 @@
             help = true;
             return;
         }
 
         if ((args[0].compareTo("-?") == 0)
+                || (args[0].compareTo("-h") == 0)
+                || (args[0].compareTo("--help") == 0)
+                // -help: legacy. Undocumented.
                 || (args[0].compareTo("-help") == 0)) {
             help = true;
             return;
         } else if (args[0].compareTo("-options") == 0) {
             options = true;
< prev index next >