Skip to content

Unexpected comma inserted at the end of the parsed message #763

Closed
@denberr95

Description

@denberr95

HI,

I'm implementing a CLI using spring-shell 3.1.0 and spring boot 3.1.0.
During testing I have seen that parsing the message from vscode produces this result:

@Command(group = "SAMPLE", command = "sample")
public class SampleCmd {

    @Command(description = "TEST COMMAND", command = "create")
    public void create(
            @Option(description = "Name of the cluster", required = true) String name,
            @Option(description = "Setup topology of API Management (Accepted values: CLOUD, LOCAL)", required = true) @Pattern(message = "Accepted values: CLOUD, LOCAL", regexp = "CLOUD|LOCAL") String envType,
            @Option(description = "API host", defaultValue = "my.host.com") String apiHost,
            @Option(description = "API port", defaultValue = "443") int apiPort,
            @Option(description = "API Base Path", defaultValue = "/v3") String apiBasePath,
            @Option(description = "Enable HTTPS", defaultValue = "true") boolean useSsl) {
        System.out.println("OK");
    }

TEST 1: OK
image

TEST 2: OK
image

TEST 3: KO Because when parsing the parameters a "," is added to the value and the validator throws an exception
image

TEST 4: KO Because when parsing the parameters a "," is added to the value and the validator throws an exception
image

TEST 5: KO Because when parsing the parameters a ","
image

TEST 6: KO Because when parsing the parameters a ","
image

I have enabled all logging to capture events and message parsing: application.log.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions