Print

Print


Author: [log in to unmask]
Date: Tue Nov  3 12:40:15 2015
New Revision: 3688

Log:
Add help option to lcsim job manager.

Modified:
    projects/lcsim/trunk/job-manager/src/main/java/org/lcsim/job/JobControlManager.java

Modified: projects/lcsim/trunk/job-manager/src/main/java/org/lcsim/job/JobControlManager.java
 =============================================================================
--- projects/lcsim/trunk/job-manager/src/main/java/org/lcsim/job/JobControlManager.java	(original)
+++ projects/lcsim/trunk/job-manager/src/main/java/org/lcsim/job/JobControlManager.java	Tue Nov  3 12:40:15 2015
@@ -101,6 +101,7 @@
      */
     private static Options createCommandLineOptions() {
         final Options options = new Options();
+        options.addOption(new Option("h", "help", false, "Print help and exit"));
         options.addOption(new Option("p", "properties", true, "Load a properties file containing variable definitions"));
         options.addOption(new Option("D", "define", true, "Define a variable with form [name]=[value]"));
         options.addOption(new Option("w", "rewrite", true, "Rewrite the XML file with variables resolved"));
@@ -507,11 +508,6 @@
         
         LOGGER.config("parsing command line arguments");
 
-        // Print help and exit.
-        if (args.length == 0) {
-            printHelp();
-        }
-
         // Setup parser.
         final CommandLineParser parser = new PosixParser();
 
@@ -520,6 +516,11 @@
             commandLine = parser.parse(OPTIONS, args);
         } catch (final ParseException x) {
             throw new RuntimeException("Problem parsing command line options.", x);
+        }
+        
+        // Print help and exit.
+        if (args.length == 0 || commandLine.hasOption("h")) {
+            printHelp();
         }
 
         // Load a properties file containing variable definitions.

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1