Skip to content

--help not working when using a CompletionProvider #1368

Description

@tschoellhorn

I am using Spring-Shell 4.0.3.

When defining a command via annotations the (implicit) -help-Option does not include a default-value:

@CommandGroup(name = "samples", prefix = "samples")
@Component
public class SampleCommand {

	@Command(
		name = "foo", 
		description = "Description of 'foo'", 
		help = "Help of 'foo'")
	public void foo(
		@Argument(index = 0, description = "The desc of value") int value, 
		@Option String name) {
		System.out.println("do it : " + name);
		System.out.println("value: " + value);
	}
	
	@Command(
		name = "bar", 
		description = "Description of 'bar'", 
		help = "Help of 'bar'")
	public void bar(
		@Arguments List<Integer> values, 
		@Option String name) {
		System.out.println("do it : " + name);
		System.out.println("values: " + values);
	}
}

When running samples bar --help I get an error message:

wdc:>samples bar --help
Error while parsing command: Option '--help' requires a value

When running samples bar --help true the help will be displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/need-triageTeam needs to triage and take a first look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions