Hi! Today I noticed a bug in PicoCLI's reporting of missing required arguments. When the option-parameter separator is changed from the default =, the Missing required argument(s) message still uses = as the separator. Users would then be tempted to add the required argument using the = separator, which will inevitably result in an Unknown option message.
Adapting the example from the docs, making the --file argument required:
@Command(separator = ":") // declaratively set a separator
class OptionArg {
@Option(names = { "-f", "--file" }, required = true) String file;
}
Then, when the user fails to supply this argument, the resulting MissingParameterException will have the message Error: Missing required argument(s): --file=<file>. The use of = in this message is a bug. After all, if the user actually goes on to run the command with --file=myfile.txt, they will get an UnmatchedArgumentException because they are using the wrong separator.
Hi! Today I noticed a bug in PicoCLI's reporting of missing required arguments. When the option-parameter separator is changed from the default
=, theMissing required argument(s)message still uses=as the separator. Users would then be tempted to add the required argument using the=separator, which will inevitably result in anUnknown optionmessage.Adapting the example from the docs, making the
--fileargument required:Then, when the user fails to supply this argument, the resulting
MissingParameterExceptionwill have the messageError: Missing required argument(s): --file=<file>. The use of=in this message is a bug. After all, if the user actually goes on to run the command with--file=myfile.txt, they will get anUnmatchedArgumentExceptionbecause they are using the wrong separator.