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; }
public static void printCommandLineHelp(final String appName, final Options options) { HelpFormatter hf = new HelpFormatter(); hf.setWidth(110); hf.printHelp(appName, options, true); }
private void help() { HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(90); formatter.printHelp("PerfTimes.jar", options); System.exit(0); }