groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <>
Subject [jira] [Commented] (GROOVY-8520) Replace commons-cli with picocli in CliBuilder
Date Fri, 13 Apr 2018 12:00:00 GMT


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

Understood about the modules.

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

The "behavioural changes" have been resolved, mostly backwards compatible:
* (/) CliBuilder instances can now safely be reused to parse multiple command lines
* (/) {{@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}}. {quote}

> Replace commons-cli with picocli in CliBuilder
> ----------------------------------------------
>                 Key: GROOVY-8520
>                 URL:
>             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|]
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

View raw message