Author: [log in to unmask] Date: Fri Feb 5 16:23:30 2016 New Revision: 4170 Log: Add help option to EVIO conversion tool. Modified: java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java Modified: java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java ============================================================================= --- java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java (original) +++ java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java Fri Feb 5 16:23:30 2016 @@ -71,7 +71,7 @@ * @author Jeremy McCormick <[log in to unmask]> * @author Sho Uemura <[log in to unmask]> */ -public class EvioToLcio { +public final class EvioToLcio { /** * The default steering resource, which basically does nothing except print event numbers. @@ -113,6 +113,7 @@ */ private static Options OPTIONS = new Options(); static { + OPTIONS.addOption(new Option("h", false, "print help and exit")); OPTIONS.addOption(new Option("d", true, "detector name (required)")); OPTIONS.getOption("d").setRequired(true); OPTIONS.addOption(new Option("f", true, "text file containing a list of EVIO files")); @@ -251,10 +252,11 @@ } public void parse(String[] args) { - // Parse the command line options. + if (args.length == 0) { this.printUsage(); } + final CommandLineParser parser = new PosixParser(); CommandLine cl = null; try { @@ -262,8 +264,13 @@ } catch (final ParseException e) { throw new RuntimeException("Problem parsing command line options.", e); } + + if (cl.hasOption("h")) { + this.printUsage(); + } // Set the log level. + // TODO: Remove this argument; use java logging prop instead. if (cl.hasOption("L")) { final Level level = Level.parse(cl.getOptionValue("L").toUpperCase());