Skip to content

LongName not working with different naming option format or name does not match with input parameter #767

Closed
@denberr95

Description

@denberr95

Hi,

I'm using Spring boot 3.1.0 and Spring shell 3.1.0 with vscode.
I created the following command:

package com.tam.cli.components.cmd.sample;

import org.springframework.shell.command.annotation.Command;
import org.springframework.shell.command.annotation.Option;

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

    @Command(command = "kebab-format")
    public void kebabFormat(
            @Option(longNames = "my-value", shortNames = 'm', required = true) String myValue) {
        System.out.println("myValue: ".concat(myValue));
    }
}

Help command:

[anonymous]:> help --command sample kebab-format
NAME
       sample kebab-format - 

SYNOPSIS
       sample kebab-format [--my-value String] --help 

OPTIONS
       --my-value or -m String
       [Mandatory]

       --help or -h 
       help for sample kebab-format
       [Optional]



[anonymous]:>

When I run the command I always get this error:
image

Configuring the property spring.shell.option.naming.case-type=kebab also doesn't work.

If I change the longName value to "myValue" works but there is a comma at the end of string if I use " or ':
image

If I change the longName with another value different to name of input parameter does not work:

package com.tam.cli.components.cmd.sample;

import org.springframework.shell.command.annotation.Command;
import org.springframework.shell.command.annotation.Option;

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

    @Command(command = "kebab-format")
    public void kebabFormat(
            @Option(longNames = "nameDifferent", shortNames = 'm', required = true) String myValue) {
        System.out.println("myValue: ".concat(myValue));
    }
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions