Softhouse / jargo

Argument and options parser for java
Other
17 stars 0 forks source link

Support configuration with annotations #35

Open tomasbjerre opened 6 years ago

tomasbjerre commented 6 years ago

Like Args4J does: http://args4j.kohsuke.org/sample.html

jontejj commented 6 years ago

Not sure I like annotations for this. I wrote a little bit about in the Rationale section of the readme. Annotations are not as typesafe/flexible. I think it's better if this project does not try to copy libraries that have another philosophy.

jontejj commented 6 years ago

Maybe you can give some reasons for doing it?

tomasbjerre commented 6 years ago

Only reason is to get cleaner, and less, code.

Perhaps a better idea is to create a jargo-annotated that adds support for annotations. And depends on jargo to implement that.

jontejj commented 6 years ago

That's a very nice idea! I would suggest to do it in a separate github repo though, and once it's been incubated and tested enough, it can be like jargo-addons, a module in the jargo repo. But before it's well worked out, it's better to have it separate. I'm afraid that supporting both will be confusing for new-comers :(

jontejj commented 6 years ago

The type information that constructing Argument instances gives you with jargo will be very tricky to mimic with annotations though, that's why I created jargo :). I saw how it limited http://jcommander.org/. And on a second thought, it will be pretty involved to not modify Argument, CommandLineParser and InternalStringParser, so having it as an external module might not be so easy. Perhaps if we rethink it all and basically only reuse StringParser and the implementations in StringParsers, but even then, some of them are bound to Argument and so on. But maybe you like challenges? :)