I'm converting an existing application to use picocli. One of the existing options looks like this:
-t, --threads [1, n] for fixed thread pool, 'cpus' for number of cpus, 'cached' for cached
This allows the option to be a positive integer or one of a couple special strings. The existing code treats it as a string, and if it's not one of the special strings, passes it to Integer.parseInt
.
I can do the same thing with picocli, of course, but I was wondering if there was a better way to handle this. E.g., something that allows multiple fields to be used for the same option, with the appropriate one being filled in based on what was passed? This might also allow me to use a enum for the possible string options.