Need to parse and validate user supplied parameters for video encoders, in the 
form of "\--option1:value --option2 --option3:value", which are unique for each 
encoder we have defined. option fields must be in a set of predefined such 
fields, while values have to be in a certain range for integers, have to be of 
certain specific values for strings, or maybe be a valid file path.

<https://nim-lang.org/docs/parseopt.html> only does the parsing which is not 
that hard, and not that useful to me without validation, as I'd need to extract 
the data from its object anyway after parsing. The other command line libs in 
nimble that I looked at all have parsing, but no validation options.

<https://github.com/captainbland/nim-validation> \- this is kind of nice, but 
only does validation on object fields, and I am not sure I want an object with 
tens or 100 fields. I would have to look into how to handle iterating over 
fields. Worth keeping in mind.

<https://github.com/sealmove/binarylang> with the help of sealmove, I do have a 
working implementation using this. Downside is, binarylang was used for binary 
streams, not string parsing, author believes it's not a proper context to 
utilize it in.

I am curious how would you implement this. Without using 100 line long case 
statements, for each option.

Bonus features would be the ability to "inherit" these values:constraints from 
an encode type and extend them, like with classes. So I don't have to repeat 
100 lines for each slightly different version or a fork that changed an option 
and so on.

A nice thing to have would be runtime loading of these values, so they don't 
need to be known at compile time. but not strictly necessary.

Reply via email to