spring-projects / spring-shell

Spring based shell
http://projects.spring.io/spring-shell/
Apache License 2.0
724 stars 394 forks source link

Inconsistent behaviour on passing invalid argument #1120

Closed kulkarnipradnyas closed 3 weeks ago

kulkarnipradnyas commented 4 weeks ago
@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
jvalkeal commented 4 weeks ago

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