org.springframework.shell.jline.PromptProvider Java Examples

The following examples show how to use org.springframework.shell.jline.PromptProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SshShellCommandFactory.java    From ssh-shell-spring-boot with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param shellListenerService shell listener service
 * @param banner               shell banner
 * @param promptProvider       prompt provider
 * @param shell                spring shell
 * @param completerAdapter     completer adapter
 * @param parser               jline parser
 * @param environment          spring environment
 * @param properties           ssh shell properties
 */
public SshShellCommandFactory(SshShellListenerService shellListenerService,
                              @Autowired(required = false) Banner banner,
                              @Lazy PromptProvider promptProvider,
                              Shell shell,
                              JLineShellAutoConfiguration.CompleterAdapter completerAdapter, Parser parser,
                              Environment environment,
                              SshShellProperties properties) {
    this.shellListenerService = shellListenerService;
    this.shellBanner = banner;
    this.promptProvider = promptProvider;
    this.shell = shell;
    this.completerAdapter = completerAdapter;
    this.parser = parser;
    this.environment = environment;
    this.properties = properties;
}
 
Example #2
Source File: SshShellRunnable.java    From ssh-shell-spring-boot with Apache License 2.0 6 votes vote down vote up
public SshShellRunnable(SshShellProperties properties, ChannelSession session,
                        SshShellListenerService shellListenerService, Banner shellBanner,
                        PromptProvider promptProvider, Shell shell,
                        JLineShellAutoConfiguration.CompleterAdapter completerAdapter, Parser parser,
                        Environment environment, org.apache.sshd.server.Environment sshEnv,
                        SshShellCommandFactory sshShellCommandFactory, InputStream is,
                        OutputStream os, ExitCallback ec) {
    this.properties = properties;
    this.session = session;
    this.shellListenerService = shellListenerService;
    this.shellBanner = shellBanner;
    this.promptProvider = promptProvider;
    this.shell = shell;
    this.completerAdapter = completerAdapter;
    this.parser = parser;
    this.environment = environment;
    this.sshEnv = sshEnv;
    this.sshShellCommandFactory = sshShellCommandFactory;
    this.is = is;
    this.os = os;
    this.ec = ec;
}
 
Example #3
Source File: SshShellAutoConfiguration.java    From ssh-shell-spring-boot with Apache License 2.0 6 votes vote down vote up
/**
 * Primary shell application runner which answers true to {@link InteractiveShellApplicationRunner#isEnabled()}
 *
 * @param lineReader     line reader
 * @param promptProvider prompt provider
 * @param parser         parser
 * @param shell          spring shell
 * @param environment    spring environment
 * @return shell application runner
 */
@Bean
@Primary
public InteractiveShellApplicationRunner sshInteractiveShellApplicationRunner(LineReader lineReader,
                                                                              PromptProvider promptProvider,
                                                                              Parser parser, Shell shell,
                                                                              Environment environment) {
    return new InteractiveShellApplicationRunner(lineReader, promptProvider, parser, shell, environment) {

        @Override
        public boolean isEnabled() {
            return true;
        }

        @Override
        public void run(ApplicationArguments args) {
            // do nothing
        }
    };
}
 
Example #4
Source File: InteractiveShellLifecycle.java    From Cleanstone with MIT License 5 votes vote down vote up
@Lazy
public InteractiveShellLifecycle(LineReader lineReader, PromptProvider promptProvider, Shell shell) {
    this.lineReader = lineReader;
    this.promptProvider = promptProvider;
    this.shell = shell;
    this.thread = new Thread(this);
}
 
Example #5
Source File: SshShellAutoConfiguration.java    From ssh-shell-spring-boot with Apache License 2.0 5 votes vote down vote up
/**
 * Primary prompt provider
 *
 * @param properties ssh shell properties
 * @return prompt provider
 */
@Bean
@ConditionalOnMissingBean
public PromptProvider sshPromptProvider(SshShellProperties properties) {
    return () -> new AttributedString(properties.getPrompt().getText(),
            AttributedStyle.DEFAULT.foreground(properties.getPrompt().getColor().toJlineAttributedStyle()));
}
 
Example #6
Source File: SshShellRunnable.java    From ssh-shell-spring-boot with Apache License 2.0 4 votes vote down vote up
public SshShellInputProvider(LineReader lineReader, PromptProvider promptProvider) {
    super(lineReader, promptProvider);
}