Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 90714 invoked from network); 8 May 2008 12:59:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 May 2008 12:59:20 -0000 Received: (qmail 55038 invoked by uid 500); 8 May 2008 12:59:21 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 54967 invoked by uid 500); 8 May 2008 12:59:21 -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 54956 invoked by uid 99); 8 May 2008 12:59:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 May 2008 05:59:20 -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; Thu, 08 May 2008 12:58:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B7FB4234C10A for ; Thu, 8 May 2008 05:58:55 -0700 (PDT) Message-ID: <293467962.1210251535752.JavaMail.jira@brutus> Date: Thu, 8 May 2008 05:58:55 -0700 (PDT) From: "HAUTION Philippe (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (CLI-154) Incomplete usage documentation about Java property option In-Reply-To: <858491714.1209547135689.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-154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595220#action_12595220 ] HAUTION Philippe commented on CLI-154: -------------------------------------- Yes, you are right, using Option.hasArgs() instead of Option.hasArg() is a simpler solution to the first issue than doing a .setArgs(Option.UNLIMITED_VALUES). > Incomplete usage documentation about Java property option > --------------------------------------------------------- > > Key: CLI-154 > URL: https://issues.apache.org/jira/browse/CLI-154 > Project: Commons CLI > Issue Type: Bug > Components: CLI-1.x > Affects Versions: 1.0, 1.1 > Reporter: HAUTION Philippe > Fix For: 1.2 > > Original Estimate: 1h > Remaining Estimate: 1h > > On Usage Scenarios page http://jakarta.apache.org/commons/cli/usage.html, in the "Java property option" section of "Ant example", after the creation of the property Option, ie : > Option property = OptionBuilder.withArgName( "property=value" ) > .hasArg() > .withValueSeparator() > .withDescription( "use value for given property" ) > .create( "D" ); > One should add : > property.setArgs(Option.UNLIMITED_VALUES); > for the example to work properly. > In the "Querying the commandline" section, the code line : > this.buildfile = line.getValue( "buildfile" ); > should be : > this.buildfile = line.getOptionValue( "buildfile" ); > Also some parsing code could be given about the special property option, for instance : > Properties props = new Properties(); > if( line.hasOption( "D" ) ) { > String[] args = line.getOptionValues( "D" ); > for (int i = 0; i < args.length; i += 2) { > String propertyName = args[i]; > String propertyValue = null; > if (i + 1 < args.length) > propertyValue = args[i + 1]; > props.put(propertyName, propertyValue); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.