Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify a list of valid values to an option. #36

Open
jarrodhroberson opened this issue Aug 7, 2015 · 3 comments
Open

Allow to specify a list of valid values to an option. #36

jarrodhroberson opened this issue Aug 7, 2015 · 3 comments

Comments

@jarrodhroberson
Copy link

for example:

@Option(shortName = "f", longName = "format", defaultValue = "csv", validValues = "csv,json,xml", description = "Output File Format")
public Set<String> getFormats();

If it also auto generated an addition to the description like "Output File Format defaultValue=csv valid=[csv,json,xml]" it would go a long way to adding more information with no effort.

@lexicalscope
Copy link
Owner

I wonder if a set of an enum would work. Or if it doesn't that might be the
way to implement it cleaner. Certainly would accept a patch adding this
feature, or I will look at it when I get time.
On 7 Aug 2015 4:21 pm, "Jarrod Roberson" notifications@github.com wrote:

for example:

@option(shortName = "f", longName = "format", defaultValue = "csv", validValues = "csv,json,xml", description = "Output File Format")
public Set getFormats();

If it also auto generated an addition to the description like "Output
File Format defaultValue=csv valid=[csv,json,xml]" it would go a long way
to adding more information with no effort.


Reply to this email directly or view it on GitHub
#36.

@jarrodhroberson
Copy link
Author

I will add this but I gave a cursory look at it and all the indirection made it hard to see where to begin.

@lexicalscope
Copy link
Owner

Umm, yes I can understand that. I am slowly refactoring it to allow all the
different parts to be swapped out so that people can plug in their own
parser, validator, etc, but its not finished yet and its not documented how
to do it. ArgumentPresenterImpl is what you want, the main loop is in the
presentArguments method it calls out to all the other parts.
On 9 Aug 2015 5:06 am, "Jarrod Roberson" notifications@github.com wrote:

I will add this but I gave a cursory look at it and all the indirection
made it hard to see where to begin.


Reply to this email directly or view it on GitHub
#36 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants