Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.Environment;
import org.springframework.shell.core.NonInteractiveShellRunner;
import org.springframework.shell.core.ShellRunner;
import org.springframework.shell.core.command.Command;
import org.springframework.shell.core.command.CommandParser;
Expand All @@ -67,6 +68,7 @@
* @author Florent Biville
* @author Mahmoud Ben Hassine
* @author Piotr Olaszewski
* @author David Pilar
*/
@AutoConfiguration
@EnableConfigurationProperties(SpringShellProperties.class)
Expand Down Expand Up @@ -109,6 +111,13 @@ public ShellRunner jlineShellRunner(JLineInputProvider inputProvider, CommandPar
return jLineShellRunner;
}

@Bean
@ConditionalOnProperty(prefix = "spring.shell.interactive", name = "enabled", havingValue = "false")
public ShellRunner jlineNonInteractiveShellRunner(CommandParser commandParser, CommandRegistry commandRegistry,
Terminal terminal) {
return new NonInteractiveShellRunner(commandParser, commandRegistry, terminal.writer());
}

@Bean
public LineReader lineReader(Terminal terminal, Parser parser, CommandCompleter commandCompleter,
CommandHighlighter commandHighlighter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public ShellRunner systemShellRunner(ConsoleInputProvider consoleInputProvider,
}

@Bean
@ConditionalOnMissingClass("org.springframework.shell.jline.DefaultJLineShellConfiguration")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I see we are using the same condition on the interactive shell configuration just above. So applying the same logic for the non-interactive shell seems reasonable to me.

@ConditionalOnProperty(prefix = "spring.shell.interactive", name = "enabled", havingValue = "false")
public ShellRunner nonInteractiveShellRunner(CommandParser commandParser, CommandRegistry commandRegistry) {
return new NonInteractiveShellRunner(commandParser, commandRegistry);
Expand Down