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

wish: explicitly support input validation #215

Closed
markstos opened this issue Apr 21, 2014 · 4 comments
Closed

wish: explicitly support input validation #215

markstos opened this issue Apr 21, 2014 · 4 comments

Comments

@markstos
Copy link

I see there is "coercion" now for input parameters, but it's not clear what happens if an invalid value is given that doesn't coerce.

For example, I have an option named --format that I want to restrict to values of csv or json.

If the coercion system already serves the purpose, the documentation should be updated to explain what happens when an argument is provided, but it fails to coerce.

@tj
Copy link
Owner

tj commented Apr 25, 2014

yeah good call, nothing specific IIRC, since null etc could be valid, so if it's really invalid the function should throw

@SomeKittens
Copy link
Collaborator

If you want to coerce, just throw/error in your coercing function - there are no plans to do that in .option

@cirosantilli
Copy link

Keyword: choices like in python argparser choices: https://docs.python.org/3/library/argparse.html#choices

@shadowspawn
Copy link
Collaborator

Thanks for link @cirosantilli , added to open issue #518

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

5 participants