[ https://issues.apache.org/jira/browse/CLI-320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved CLI-320. --------------------------------- Fix Version/s: 1.7.0 Resolution: Fixed [~paulk] PR applied, in git master now and snapshot builds here: [https://repository.apache.org/content/repositories/snapshots/commons-cli/commons-cli/1.7.0-SNAPSHOT/] > Awkward behavior of Option.builder() for multiple optional args > --------------------------------------------------------------- > > Key: CLI-320 > URL: https://issues.apache.org/jira/browse/CLI-320 > Project: Commons CLI > Issue Type: Bug > Affects Versions: 1.6.0 > Reporter: Paul King > Priority: Major > Fix For: 1.7.0 > > > This is to flag the breaking change for 1.6.0 as mentioned here: > [https://github.com/apache/commons-cli/commit/34278395b6115752774c3d16a00292591da2dde3#comments] > The possible fixes seem to be: > * add Javadoc for the {{numberOfArgs}} and {{optionalArg}} methods saying > that the former must come after the latter. > * make {{optionalArg}} fail (early) if the number of args is already set, so > this change in behavior becomes explicit via the API rather than just a > behavioral breakage later. > * tweak the behavior of {{optionalArg}} to only adjust the arg count if not > already set. This removes the implicit assumption of size 1 which I think > better aligns with what you get when using the (deprecated) > {{OptionBuilder#hasOptionalArgs(int)}}. I'll create a PR for this possible > fix. -- This message was sent by Atlassian Jira (v8.20.10#820010)