jcommander icon indicating copy to clipboard operation
jcommander copied to clipboard

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

Open JaumeRibas opened this issue 2 years ago • 1 comments

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.

JaumeRibas avatar Jun 11 '23 16:06 JaumeRibas

@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?

mkarg avatar Apr 27 '24 09:04 mkarg

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

JaumeRibas avatar May 18 '24 18:05 JaumeRibas

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

mkarg avatar May 18 '24 21:05 mkarg

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

JaumeRibas avatar May 19 '24 06:05 JaumeRibas