Hi Remko,
I'm wondering if you could help me with something.
In Jbang we have a couple of options that use Consumers and Preprocessors to do special 0..1 arity handling (either by forcing you to use "=" or by detecting if the next argument is a valid value or not).
Anyway, I've run into a problem where some of these options have different values for `defaultValue` and `fallbackValue` but it seems that picocli doesn't do it's normal default/fallback handling the moment Consumers and Preprocessors are in play.
So I thought to handle it myself by doing something like this:
public boolean preprocess(Stack<String> args, CommandLine.Model.CommandSpec commandSpec, CommandLine.Model.ArgSpec argSpec, Map<String, Object> info) {
var opt = (CommandLine.Model.OptionSpec) argSpec;
if (OPTION_EXISTS_IN_ARGS) {
if (" ".equals(info.get("separator"))) {
args.push(opt.fallbackValue());
}
} else {
args.push(opt.defaultValue());
}
return false;
}
I know that `ParseResult` has a method called `hasMatchedOption()` but that isn't available yet at that point. There is a `tentativeMatch` field that hold useful information but it isn't publicly exposed.
I've tried hacking my way around this by looking at the `args` and `commandSpec.commandLine().getParseResult().expandedArgs()` and deducing if the arg was given on the command line, but then I run into the problem that the Consumer/Preprocessor can be run multiple times with different arguments (once during actual parameter parsing and once when dealing with default values) and unfortunately `parseResultBuilder.isInitializingDefaultValues` isn't available either so I can't distinguish between the two different runs and therefore can't guarantee it will return the same value in both cases.
So I've hit a bit of a dead end here and was wondering if you might have an idea on how to solve this?
Thanks!
-Tako