Remko Popma commented on GROOVY-8520:

I took a quick look at the PR you linked to. The problem I see is that picocli 
and commons-cli have a different way of looking at things that don't map 
one-on-one. It will be difficult to capture those different world views in a 
generic SPI. Using the picocli API to re-implement CliBuilder was relatively 
straightforward. Not sure how much value an intermediate API would add. The 
tricky thing was making the _behaviour_ backwards compatible which is more of a 
semantics issue.

Understood about the modules.

*Status update* (sorry if I swamped everyone with the intermediate updates):
* (?) all tests pass except for the 
{{testMultipleOccurrencesSeparateJuxtaposed}} test mentioned above.
* (/) the "invalid" tests have been migrated to use the picocli API instead of 
the commons-cli API

The "behavioural changes" have been resolved, mostly backwards compatible:
* (/) CliBuilder instances can now safely be reused to parse multiple command 
* (/) {{@Unparsed Integer[]}} fields/methods work as expected
* (/)  as in previous CliBuilder versions, Boolean fields/setters are now 
initialized to false even when they were not specified on the command line
* (?) The default behaviour is different than before: errors will go to 
{{stderr}} and requested {{--help}} will go to {{stdout}} (in previous 
CliBuilder everything went to {{stdout}}). However, the {{setWriter}} property 
setter sets both the {{writer}} and the {{errorWriter}} to the specified value 
so client code that relies on customizing the writer works as before. I believe 
this is a reasonable compromise. If you disagree we can remove the 
{{errorWriter}} and be fully backwards compatible.
{quote}Why a separate errorWriter? This follows command line application 
conventions: diagnostic output should go to {{stderr}} to prevent it from being 
parsed when its output is used as input for another process. Sending requested 
{{--help}}  to {{stdout}} allows users to pipe it to {{less}} or {{grep}}. 

> 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

Reply via email to