[
https://issues.apache.org/jira/browse/CLI-154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Emmanuel Bourg updated CLI-154:
-------------------------------
Component/s: (was: CLI-1.x)
Documentation
> 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: Documentation
> 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.