[ https://issues.apache.org/jira/browse/GROOVY-8520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439675#comment-16439675 ]
Remko Popma commented on GROOVY-8520: ------------------------------------- I now believe the remaining failing test is really the result of an idiosyncrasy in commons-cli: When a parameter is attached to the short option (e.g. {{-a1}}), the value of {{args}} is ignored. No validation error like "error: Missing argument for option: a" ever occurs. To illustrate: {code} // using GROOVY_2_5_X branch: CliBuilder based on commons-cli def cli = new CliBuilder() cli.a(args: 2, 'arguments') assertNull(cli.parse(['-a', '1'])) // as expected: '-a' option needs 2 params options = cli.parse(['-a1']) // I would expect parsing to fail, but it succeeds. assertEquals('1', options.a) // Why is 1 option-param okay here? assertNull(cli.parse(['-a', '1', '-a', '2'])) // as expected: each '-a' option needs 2 params options = cli.parse(['-a1', '-a2']) assertEquals('1', options.a) // similar to preceding; why does this succeed?... assertEquals(['1', '2'], options.as) options = cli.parse(['-a1', '-a2', '-a3']) assertEquals(['1', '2', '3'], options.as) // even this is okay... {code} Is this behaviour desirable? If so, I can add an option to picocli to ignore arity for attached option-arguments. Do we want to support this behaviour? While adding more tests, another behaviour I noticed that I found strange is this: {code} def cli = new CliBuilder() cli.b(args: 2, valueSeparator: ',', 'arguments') options = cli.parse(['-b1,2,3']) assert options.bs == ['1', '2'] | | | | | false | ['1', '2,3'] groovy.util.OptionAccessor@ba2f4ec {code} I would expect the parser to split first, and then to validate the result. It looks like, counter to my expectations, common-cli stops splitting when the input has been split into {{args}} chunks. The last chunk may still contain the value separator character. Again, is this behaviour desirable, and should it be supported? > Replace commons-cli with picocli in CliBuilder > ---------------------------------------------- > > Key: GROOVY-8520 > URL: https://issues.apache.org/jira/browse/GROOVY-8520 > Project: Groovy > Issue Type: Improvement > Components: command line processing > Reporter: Remko Popma > Priority: Major > > This ticket proposes to replace commons-cli with picocli in > {{groovy.util.CliBuilder}}. > See [discussion on the mailing > list|https://lists.apache.org/thread.html/d60b6d5d4411e9ba0d7dc209cde8a9bb4abb00f0b9c0322f068c322e@%3Cdev.groovy.apache.org%3E] > for the original proposal and comparison with other CLI libraries. > Goals for the initial implementation: > * preserve the current CliBuilder behaviour as much as possible > * deliver an implementation, tests and documentation in time to be included > in the 2.5 GA release -- This message was sent by Atlassian JIRA (v7.6.3#76005)