commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Läubrich (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CLI-179) Needs "standalone" options that can be used even if required options are not set
Date Mon, 13 Mar 2017 09:06:04 GMT

    [ https://issues.apache.org/jira/browse/CLI-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15907045#comment-15907045
] 

Christoph Läubrich commented on CLI-179:
----------------------------------------

I think this can be usefull also (@[~mscheper] You can vote for issue on the upper right in
the "people" tab).
Maybe the whole part of required/optional/help... whatever can be reworked in such a way that
there is an interface for an InvalidOptionHandler that can be passed to the parser.
That way several usecases can be handled without adding more and more "magic", the Parser
then can just call the InvalidOptionHandler e.g with 'handleInvalidOption(String option, Reason
reason, Option... option)' where Reasion can be one of MissingRequiredOption, UnknownOption
and such, and the Option array containing any Options (if applicable) for the context.
A default implementation can then throw exceptions like it is currently done and you can install
alternative ones that simply print help, collect all errors and fail after parsing or whatever
is required in the actuall use case...

> Needs "standalone" options that can be used even if required options are not set
> --------------------------------------------------------------------------------
>
>                 Key: CLI-179
>                 URL: https://issues.apache.org/jira/browse/CLI-179
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: Parser
>    Affects Versions: 1.2
>            Reporter: Joël Royer
>         Attachments: CLI-179.patch
>
>
> it is currently impossible to have options like "help" or "version" if we also have some
required options. The parsing results in an error "Missing parameters".
> But for an "help" or "version" option, it would be usefull to display the wanted information,
even if required options are not set.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message