Spring Shell integration with IntelliJ console

424 Views Asked by At

I'm using Spring-Shell v2.1.4 with IntelliJ Utlimate IDE. If I use a Flow component in a shell method I find that it does not work when launched within IntelliJ but works fine from a plain Bash terminal. For example if I have a simple @ShellMethod using the example code from the above link:

@ShellMethod("Testing for flow component")
public void flowTest() {
    Map<String, String> single1SelectItems = new HashMap<>();
    single1SelectItems.put("key1", "value1");
    single1SelectItems.put("key2", "value2");
    List<SelectItem> multi1SelectItems = Arrays.asList(SelectItem.of("key1", "value1"),
        SelectItem.of("key2", "value2"), SelectItem.of("key3", "value3"));
        ComponentFlow flow = componentFlowBuilder.clone().reset()
                .terminal(this.terminal)
                .withStringInput("field1")
                .name("Field1")
                .defaultValue("defaultField1Value")
                .and()
                .withStringInput("field2")
                .name("Field2")
                .and()
                .withConfirmationInput("confirmation1")
                .name("Confirmation1")
                .and()
                .withPathInput("path1")
                .name("Path1")
                .and()
                .withSingleItemSelector("single1")
                .name("Single1")
                .selectItems(single1SelectItems)
                .and()
                .withMultiItemSelector("multi1")
                .name("Multi1")
                .selectItems(multi1SelectItems)
                .and()
                .build();

    flow.run();
}

The method 'executes` but there is no interaction with the user: Intellij console

Compare this to executing in genuine Bash terminal:

enter image description here

This older question is similar but it refers to an earlier version of Spring CLI and the recommended solution there is a VM argument for which the stated argument no longer appears to exist in the version of Spring Shell I am using.

Is there an updated version on the VM argument or an IntelliJ run-configuration setting to give better integration with the IDE?

0

There are 0 best solutions below