spring-projects/spring-shell

Inconsistent behaviour on passing invalid argument

Closed this issue · 1 comments

@Command(command = "activate", group = "Activate/Deactivate Commands")
public class ActivationCommand {
    @Command(command = "test", description = "test")
    public void activateTest(
            @Option(longNames = "id", required = true, description = "test ID") Long id,
            @Option(longNames = "name", required = true, description = "test name") String name
            ){
        System.out.println("Activating test with id: " + id+ name);
    }
}

For the above code, I am getting the below inconsistent result. When an invalid argument is passed as a first argument then the shell throws an error log but when it is passed at the end it just ignores that. It should throw an error log on both cases.

Screenshot 2024-08-16 at 1 04 54 PM Screenshot 2024-08-16 at 1 05 40 PM

Thanks for reporting. Looks like --invalid and true are passed to name option as an arguments in this case. That's clearly wrong.