groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (GROOVY-8759) groovy.cli.picocli.CliBuilder should behave like cli.commons.CliBuilder on invalid options
Date Tue, 21 Aug 2018 00:38:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Remko Popma resolved GROOVY-8759.
---------------------------------
    Resolution: Fixed

Fixed by setting the picocli both ParserSpec's {{stopAtPositional}} and {{unmatchedOptionsArePositionalParams}}
properties to the value of {{stopAtNonOption}}:

{code}
void setStopAtNonOption(boolean stopAtNonOption) {
    this.stopAtNonOption = stopAtNonOption
    parser.stopAtPositional(stopAtNonOption)
    parser.unmatchedOptionsArePositionalParams(stopAtNonOption)
}
{code}

> groovy.cli.picocli.CliBuilder should behave like cli.commons.CliBuilder on invalid options
> ------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8759
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8759
>             Project: Groovy
>          Issue Type: Dependency upgrade
>          Components: command line processing
>    Affects Versions: 2.5.2
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>            Priority: Major
>             Fix For: 2.5.3
>
>
> When {{stopAtNonOption: false}} flag is set, the two versions of CliBuilder behave differently.
(See GROOVY-8740)
> The commons cli version of CliBuilder returns {{null}}:
> {code}
> def optCommons = new groovy.cli.commons.CliBuilder(stopAtNonOption: false).parse(['-x'])
> if (optCommons) println "Okay" else println "Error"
> {code}
> The picocli version of CliBuilder returns a non-null options object with the {{"-x"}}
value as a positional parameter:
> {code}
> def optCli = new groovy.cli.picocli.CliBuilder(stopAtNonOption: false).parse(['-x'])
> if (optCli) println "Okay" else println "Error"
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message