Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 51EFAE6C1 for ; Sat, 2 Mar 2013 14:09:14 +0000 (UTC) Received: (qmail 10956 invoked by uid 500); 2 Mar 2013 14:09:14 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 10877 invoked by uid 500); 2 Mar 2013 14:09:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 10847 invoked by uid 99); 2 Mar 2013 14:09:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Mar 2013 14:09:12 +0000 Date: Sat, 2 Mar 2013 14:09:12 +0000 (UTC) From: "Brian Pontarelli (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CLI-233) HelpFormatter missing for first option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLI-233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Brian Pontarelli updated CLI-233: --------------------------------- Description: I'm not sure if this is fixed in the master branch, but it looks like the HelpFormatter doesn't correctly output a when the first option has an argument. Sample: {code:title=Main.java|borderStyle=solid} Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("user").withDescription("Database username").isRequired().hasArg().create("u")); options.addOption(OptionBuilder.withLongOpt("pass").withDescription("Database password").isRequired().hasArg().create("p")); CommandLineParser parser = new PosixParser(); CommandLine commandLine; try { commandLine = parser.parse(options, args); } catch (ParseException e) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp(120, "Usage: Main ", e.getMessage(), options, ""); System.exit(1); } {code} The output is: {noformat} usage: Usage: Main Missing required option: u, p -p,--pass Database password -u,--user Database username {noformat} was: I'm not sure if this is fixed in the master branch, but it looks like the HelpFormatter doesn't correctly output a when the first option has an argument. Sample: Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("user").withDescription("Database username").isRequired().hasArg().create("u")); options.addOption(OptionBuilder.withLongOpt("pass").withDescription("Database password").isRequired().hasArg().create("p")); CommandLineParser parser = new PosixParser(); CommandLine commandLine; try { commandLine = parser.parse(options, args); } catch (ParseException e) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp(120, "Usage: Main ", e.getMessage(), options, ""); System.exit(1); } The output is: usage: Usage: Main Missing required option: u, p -p,--pass Database password -u,--user Database username > HelpFormatter missing for first option > -------------------------------------------- > > Key: CLI-233 > URL: https://issues.apache.org/jira/browse/CLI-233 > Project: Commons CLI > Issue Type: Bug > Components: CLI-1.x > Affects Versions: 1.2 > Reporter: Brian Pontarelli > Priority: Minor > Fix For: 1.3 > > > I'm not sure if this is fixed in the master branch, but it looks like the HelpFormatter doesn't correctly output a when the first option has an argument. Sample: > {code:title=Main.java|borderStyle=solid} > Options options = new Options(); > options.addOption(OptionBuilder.withLongOpt("user").withDescription("Database username").isRequired().hasArg().create("u")); > options.addOption(OptionBuilder.withLongOpt("pass").withDescription("Database password").isRequired().hasArg().create("p")); > CommandLineParser parser = new PosixParser(); > CommandLine commandLine; > try { > commandLine = parser.parse(options, args); > } catch (ParseException e) { > HelpFormatter helpFormatter = new HelpFormatter(); > helpFormatter.printHelp(120, "Usage: Main ", e.getMessage(), options, ""); > System.exit(1); > } > {code} > The output is: > {noformat} > usage: Usage: Main > Missing required option: u, p > -p,--pass Database password > -u,--user Database username > {noformat} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira