cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.97k stars 334 forks source link

MainParameter class is not public so it cannot be used when creating a custom IUsageFormatter class #559

Closed JaumeRibas closed 6 months ago

JaumeRibas commented 1 year ago

I tried copying the implementation of the DefaultUsageFormatter to customize it and it gives a compile error because it references the MainParameter class which is not public.

mkarg commented 7 months ago

@JaumeRibas I assume you mean https://github.com/cbeust/jcommander/blob/2d3fc624514fd7ca9e99dd5b2b06ab274495ebb6/src/main/java/com/beust/jcommander/JCommander.java#L67

Could you please provide a PR that makes the class public and that proofs the usefulness of doing so? Thanks.

Edit: Maybe it might be a better idea to let MainParameter implement an interface that allows to access main parameter's elements insted of making the class itself public?

JaumeRibas commented 6 months ago

Whichever you think is best, as long as people can replicate and tweak the functionality in the DefaultUsageFormatter class. Thanks

mkarg commented 6 months ago

I think we should go with the interface. Will you provide a PR?

JaumeRibas commented 6 months ago

Sure, I'll try. It's time I learn.