Issue Details (XML | Word | Printable)

Key: CLI-142
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Henning Schmiedehausen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons CLI

CLI Parser is not very extension friendly

Created: 06/Aug/07 02:20 PM   Updated: 08/May/08 06:43 AM
Return to search
Component/s: CLI-1.x
Affects Version/s: 1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works parser.patch 2007-08-06 02:21 PM Henning Schmiedehausen 5 kB

Resolution Date: 08/May/08 06:43 AM


 Description  « Hide
The Parser class is not really extension friendly.
  • cmd is private, should either be protected or have a getter/setter pair
  • options and requiredOptions should have getter/setters (requiredOptions depends on options)
  • processProperties is private, should be protected
  • processOptions is private, should be protected


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henning Schmiedehausen added a comment - 06/Aug/07 02:24 PM
BTW: If you are looking for an use case, here it is:

I have a dynamic Task executor, that has a fixed set of options (list, info, run) and loads an additional set of options depending on the service name given as an argument to list/info/run. So as soon as one of these three has been encountered, I use processOptions to dynamically query the task in question about its options and add it to the running parser.

(And I do it over JMX, hence I need serializable classes. )


Henri Yandell added a comment - 14/Aug/07 02:06 PM
It all seemed rather unextendable to me. Have you looked at CLI2, and do you have any thoughts on whether that looks more extendable?

I backed away from making things more extensible rather quickly in CLI1 when I hit bits like that, seemed like a lot of backwards compat issues just waiting to happen.


Henri Yandell added a comment - 14/Aug/07 02:06 PM
Consider for 1.2; or mark as WONTFIX if 2.0 looks to be better designed for this.

Henning Schmiedehausen added a comment - 14/Aug/07 02:54 PM
Legacy application, got it to work with that hack. I might consider moving to CLI 2 in the near future, for now, that patch did the trick for me.

Henri Yandell added a comment - 08/May/08 06:43 AM
Now 1.1 is out, applying this patch as it looks good.