Java Code Examples for org.springframework.shell.core.JLineShellComponent#promptLoop()
The following examples show how to use
org.springframework.shell.core.JLineShellComponent#promptLoop() .
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: BootShim.java From hdfs-shell with Apache License 2.0 | 5 votes |
public ExitShellRequest run() throws IllegalAccessException { sw.start(); String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute(); JLineShellComponent shell = this.ctx.getBean("shell", JLineShellComponent.class); ExitShellRequest exitShellRequest; if (null != commandsToExecuteAndThenQuit) { boolean successful = false; exitShellRequest = ExitShellRequest.FATAL_EXIT; for (String cmd : commandsToExecuteAndThenQuit) { successful = shell.executeCommand(cmd).isSuccess(); if (!successful) { break; } } if (successful) { exitShellRequest = ExitShellRequest.NORMAL_EXIT; } } else { shell.start(); shell.promptLoop(); exitShellRequest = shell.getExitShellRequest(); if (exitShellRequest == null) { exitShellRequest = ExitShellRequest.NORMAL_EXIT; } shell.waitForComplete(); } sw.stop(); if (shell.isDevelopmentMode()) { System.out.println("Total execution time: " + sw.getLastTaskTimeMillis() + " ms"); } return exitShellRequest; }
Example 2
Source File: BootShim.java From spring-data-dev-tools with Apache License 2.0 | 5 votes |
public ExitShellRequest run() { sw.start(); String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute(); JLineShellComponent shell = (JLineShellComponent) this.ctx.getBean("shell", JLineShellComponent.class); ExitShellRequest exitShellRequest; if (null != commandsToExecuteAndThenQuit) { boolean successful = false; exitShellRequest = ExitShellRequest.FATAL_EXIT; String[] arr$ = commandsToExecuteAndThenQuit; int len$ = commandsToExecuteAndThenQuit.length; for (int i$ = 0; i$ < len$; ++i$) { String cmd = arr$[i$]; successful = shell.executeCommand(cmd).isSuccess(); if (!successful) { break; } } if (successful) { exitShellRequest = ExitShellRequest.NORMAL_EXIT; } } else { shell.start(); shell.promptLoop(); exitShellRequest = shell.getExitShellRequest(); if (exitShellRequest == null) { exitShellRequest = ExitShellRequest.NORMAL_EXIT; } shell.waitForComplete(); } sw.stop(); if (shell.isDevelopmentMode()) { System.out.println("Total execution time: " + sw.getLastTaskTimeMillis() + " ms"); } return exitShellRequest; }