Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 64565 invoked from network); 29 Sep 2008 12:13:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Sep 2008 12:13:06 -0000 Received: (qmail 41050 invoked by uid 500); 29 Sep 2008 12:13:04 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 40680 invoked by uid 500); 29 Sep 2008 12:13:04 -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 40669 invoked by uid 99); 29 Sep 2008 12:13:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2008 05:13:04 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2008 12:12:10 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E94F3234C1E5 for ; Mon, 29 Sep 2008 05:12:44 -0700 (PDT) Message-ID: <2013410709.1222690364954.JavaMail.jira@brutus> Date: Mon, 29 Sep 2008 05:12:44 -0700 (PDT) From: "J. Lewis Muir (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (CLI-169) HelpFormatter ignores Option's value separator In-Reply-To: <346727257.1222527464497.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CLI-169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] J. Lewis Muir updated CLI-169: ------------------------------ Attachment: long-opt-name-arg-separator.patch > HelpFormatter ignores Option's value separator > ---------------------------------------------- > > Key: CLI-169 > URL: https://issues.apache.org/jira/browse/CLI-169 > Project: Commons CLI > Issue Type: Bug > Components: Help formatter > Affects Versions: 1.2 > Reporter: J. Lewis Muir > Fix For: 1.2 > > Attachments: long-opt-name-arg-separator.patch, use-value-separator-in-help-formatter.patch > > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > The HelpFormatter always renders a space between the option name and value even if the option has a value separator that is not a space. For example, this option: > {code} > Option option = new Option("B", "bsize", true, "block size in bytes"); > option.setArgName("SIZE"); > option.setValueSeparator('='); > {code} > is rendered like this: > {noformat} > -B,--bsize block size in bytes > {noformat} > But I would expect it to be rendered like this: > {noformat} > -B,--bsize= block size in bytes > {noformat} > For the automatically generated usage message, a similar problem exists. I changed it to try to use the value separator when rendering the option with the short name only if there's no long name. If there's no short name, it always tries to use the value separator with the long name rendering. > For example, consider this option containing a short name and a specified value separator: > {code} > Option option = new Option("B", true, "block size in bytes"); > option.setArgName("SIZE"); > option.setValueSeparator('='); > {code} > The automatically generated usage message with my changes would look like this: > {noformat} > usage: app [-B=] > {noformat} > If the same option included a long name too: > {code} > Option option = new Option("B", "bsize", true, "block size in bytes"); > option.setArgName("SIZE"); > option.setValueSeparator('='); > {code} > with my changes the value separator is assumed to be meant for use with the long name. The short option rendering in the usage message will not try to use the value separator and will render the usage message like this: > {noformat} > usage: app [-B ] > {noformat} > Attached is a patch for these fixes with test cases. The patch is against [http://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x]. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.