Skip to content

PicoCLI does not use customized option-parameter separator in missing argument message #2500

@Jerrythafast

Description

@Jerrythafast

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions