git-like-cli icon indicating copy to clipboard operation
git-like-cli copied to clipboard

Validatable option parameters

Open grkvlt opened this issue 13 years ago • 1 comments

The parameters for an option should be validatable (beyond the allowed options property). This could be done by accepting a class name for a Predicate which tests if they are acceptable. Some standard predicates could allow things like regular expressions. For example:

@Option(name = "-v", validator = CheckValid.class)
String v;

grkvlt avatar May 15 '12 14:05 grkvlt

The plan is to use Java Bean Validation Framework (http://bval.apache.org/) for command validation. The real issue is if we want this to be core to the CLI framework or an add-on. The main issue is people usually have different ideas on how to report errors to the user.

dain avatar May 15 '12 17:05 dain