DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33341>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33341 Summary: HelpFormatter doesn't function correctly for options with only LongOpt Product: Commons Version: 1.0 Final Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: CLI AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] The following doesn't work (org.apache.commons.cli.HelpFormatter )correctly and doesn't print out the help menu of options that only specify LongOpt. The output is: [java] usage: -a | -d | --shutdown | -s | -h [-r <email>] [-f <flight>] [-t] [java] VendMore - Email Management System [java] -t,--test test mode - makes no permanent changes. [java] --shutdown shutdown rpc server. [java] -a,--add add user to email queue. [java] -d,--delete delete user from email queue. [java] -f,--flight flight which is the index into the email being sent [java] -h,--help Print this usage information. [java] -r recipient's email [java] -s,--send send email command [java] For more information, see Steve Morin [java] Java Result: 1 it is missing the following options when printing the help display. options.addOption(OptionBuilder.withDescription("hostname for the XmlRpc client to connect to.").withLongOpt("hostname").create()); options.addOption(OptionBuilder.withDescription("port for the xmlrpc client to use.").withLongOpt("port").create()); options.addOption(OptionBuilder.withDescription("additional xmlrpc connection").withLongOpt("urlpath").create()); options.addOption(OptionBuilder.withDescription("add a parameter form name=value.").hasArg().withLongOpt("params").create()); example of the offending code private CommandLineParser cmd; private Options options; private OptionGroup ogmain; public CmdLineArg() { super(); cmd = new BasicParser(); options = new Options(); ogmain = new OptionGroup(); ogmain.setRequired(true); localinit(); init(); } public CommandLine run(String[] args) { try { options.addOption(OptionBuilder.withDescription("add a parameter form name=value.").hasArg().withLongOpt("params").create()); options.addOption(OptionBuilder.withDescription("recipient's email").hasArg().create('r')); options.addOption(OptionBuilder.withDescription("flight which is the index into the email being sent").withLongOpt("flight").hasArg().create('f')); options.addOption(OptionBuilder.withDescription("test mode - makes no permanent changes.").withLongOpt("test").create('t')); ogmain.addOption(OptionBuilder.withDescription("Print this usage information.").withLongOpt("help").create('h')); ogmain.addOption(OptionBuilder.withDescription("send email command").withLongOpt("send").hasArg().create('s')); ogmain.addOption(OptionBuilder.withDescription("add user to email queue.").withLongOpt("add").create('a')); ogmain.addOption(OptionBuilder.withDescription("delete user from email queue.").withLongOpt("delete").create('d')); ogmain.addOption(OptionBuilder.withDescription("shutdown rpc server.").withLongOpt("shutdown").create()); options.addOption(OptionBuilder.withDescription("hostname for the XmlRpc client to connect to.").withLongOpt("hostname").create()); options.addOption(OptionBuilder.withDescription("port for the xmlrpc client to use.").withLongOpt("port").create()); options.addOption(OptionBuilder.withDescription("additional xmlrpc connection").withLongOpt("urlpath").create()); options.addOptionGroup(this.ogmain); return cmd.parse(options,args); } catch (ParseException e) { printUsage(); System.exit(1); return null; } } protected void printUsage(){ HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp(getUSAGE(),getHEADER(),options,getFOOTER()); } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
