Skip to content

Completion for options and option values is not working #1242

@czpilar

Description

@czpilar

This is regression from 4.0.0-M1.

4.0.0-M1

Consider configuration for 4.0.0-M1:

@SpringBootApplication
@CommandScan
@Command
public class SpringShellApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringShellApplication.class, args);
	}

	@Command(command = "hello")
	public void hello(@Option(longNames = "name") @OptionValues(provider = "helloNameCompletionProvider") String name) {
		System.out.println("Hello " + name + "!");
	}

	@Bean
	public CompletionProvider helloNameCompletionProvider() {
		return completionContext -> Stream.of("Peter", "Paul", "Mary").map(CompletionProposal::new).toList();
	}

}

Steps to reproduce:

  1. Write hello and press tab
  2. List of options is displayed
  3. Select --name and press tab
  4. List of completion proposals is displayed
Image Image

4.0.0-RC1

Now have the same configuration for 4.0.0-RC1:

@SpringBootApplication
public class SpringShellApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringShellApplication.class, args);
	}

	@Command(name = "hello", completionProvider = "helloNameCompletionProvider")
	public void sayHello(@Option(longName = "name") String name) {
		System.out.println("Hello " + name + "!");
	}

	@Bean
	public CompletionProvider helloNameCompletionProvider() {
		return completionContext -> Stream.of("Peter", "Paul", "Mary").map(CompletionProposal::new).toList();
	}

}

Steps to reproduce:

  1. Write hello and press tab
  2. List of options should be displayed but command proposals are displayed instead
Image

Steps to reproduce:

  1. Write hello --name and press tab
  2. List of option proposals should be displayed but command proposals are displayed instead
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