Support for non-interactive shell commands

- Add support for running shell commands as a non-interactive mode.
- This works by adding new ShellApplicationRunner interface which is
  an extension to ApplicationRunner forcing to have exactly one main
  ApplicationRunner and then DefaultApplicationRunner dispatches to
  new interface ShellRunner which allows to pick between script,
  interactive and non-interactive, etc.
- It is sort of a breaking change but works much better not having
  a need to have previous hooks between application runners to disable
  things at runtime.
- All this makes it closer for a user to have a choice between
  using shell commands as is without entering interactive mode.
- Also add SpringShellProperties for better config props support
  for boot users.
- Fixes #342
This commit is contained in:
Janne Valkealahti
2021-12-31 15:30:52 +00:00
parent 7042d1f83b
commit 7298b2ce78
14 changed files with 651 additions and 214 deletions

View File

@@ -11,7 +11,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.shell.CommandRegistry;
import org.springframework.shell.MethodTarget;
import org.springframework.shell.Shell;
import org.springframework.shell.jline.InteractiveShellApplicationRunner;
import org.springframework.test.context.ContextConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
@@ -24,7 +23,7 @@ import static org.springframework.util.ReflectionUtils.findMethod;
*
* @author Sualeh Fatehi
*/
@SpringBootTest(properties = { InteractiveShellApplicationRunner.SPRING_SHELL_INTERACTIVE_ENABLED + "=" + false })
@SpringBootTest(properties = { "spring.shell.interactive.enabled=false" })
@ContextConfiguration(classes = TestCalculatorStateConfig.class)
public class CalculatorCommandsIntegrationTest extends BaseCalculatorTest {