Skip to content

Unmatched argument #1309

@mininotallarines

Description

@mininotallarines

Issue

I was playing around with the subcommands and suddenly I got an unmatched argument exception but I think this might bug.

Running the following command test start sta or test restart rest tries to autocorrect the sta and/or rest to their subcommand.

The command never runs and it just says Did you mean: restart or start?

@Command(name = "test", mixinStandardHelpOptions = true)
public class TestCommand implements Callable<Integer> {

	@Override
	public Integer call() throws Exception { throw new ParameterException(spec.commandLine(), "Missing required subcommand"); }
	
	@Command(name = "start", description = "start", mixinStandardHelpOptions = true)
	public int start(
			@Parameters(index = "0", paramLabel = "id") String id) { return 0; }
	
	@Command(name = "restart", description = "restart", mixinStandardHelpOptions = true)
	public int restart(
			@Parameters(index = "0", paramLabel = "id") String id) { return 0; }
	
}

I'm running the command using the CommandLine object as follows:

new CommandLine(new TestCommand()).execute("restart", "rest")
new CommandLine(new TestCommand()).execute("start", "sta")

Environment

Operating System Windows 10
IDE Eclipse 2020-12 (4.18.0)
Picoclli Picocli version 4.6.1

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