[jira] Commented: (CLI-99) [cli] separate definition and values

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] Commented: (CLI-99) [cli] separate definition and values

Gary D. Gregory (Jira)

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

Brian Egge commented on CLI-99:

I agree w/ Andrew.  This is a won't fix in 1.x, and is fixed in 2.x.  In 2.x you have an instance specific CommandLine object which holds the value of the parse.  This also makes unit testing a lot easier as you don't have to clear the options after each parse.

> [cli] separate definition and values
> ------------------------------------
>                 Key: CLI-99
>                 URL: https://issues.apache.org/jira/browse/CLI-99
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-2.x
>    Affects Versions: 1.0
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Ittay Dror
>            Priority: Minor
>             Fix For: 2.0
> right now Option holds both configuration parameters - that say how to parese,
> and values - the result of parsing.
> this isn't very robust if options are used at places other than main(). for
> example, if some server application wants a cli interface (e.g., through a tcp
> connection), then the best approach for it would be to have a static variable
> with the options configuration and give it to the parser each time. with the
> current code, the Options object needs to be recreated every time.
> also, iterating over Options.getOptions() is cumbersome because some options may
> actually belong to an option group. it would be helpfull if Options.getOption
> would return a collection containing Option and OptionGroup, then the user can
> iterate over it, and with a simple 'instanceof' know what type it is, and then
> handle it.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.