示例#1
0
  public static CommandLine parseCmdLine(
      final String appName, String[] args, Options options, CommandLineParser parser) {
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
      commandLine = parser.parse(options, args);
      if (commandLine.hasOption('h')) {
        hf.printHelp(appName, options, true);
        return null;
      }
    } catch (ParseException e) {
      hf.printHelp(appName, options, true);
    }

    return commandLine;
  }
示例#2
0
 public static void printCommandLineHelp(final String appName, final Options options) {
   HelpFormatter hf = new HelpFormatter();
   hf.setWidth(110);
   hf.printHelp(appName, options, true);
 }
示例#3
0
 private void help() {
   HelpFormatter formatter = new HelpFormatter();
   formatter.setWidth(90);
   formatter.printHelp("PerfTimes.jar", options);
   System.exit(0);
 }