Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import org.jboss.aesh.console.AeshConsoleCallback;
import org.jboss.aesh.console.Console;
import org.jboss.aesh.console.ConsoleCallback;
import org.jboss.aesh.console.ConsoleOperation;
import org.jboss.aesh.console.Prompt;
import org.jboss.aesh.console.settings.SettingsBuilder;
public class ConsoleExample {
public static void main(String... args) {
final Console console = new Console(new SettingsBuilder().create());
final ConsoleCallback consoleCallback = new AeshConsoleCallback() {
@Override
public int execute(ConsoleOperation operation) throws InterruptedException {
console.getShell().out().println("======>\"" + operation.getBuffer());
if (operation.getBuffer().equals("quit") || operation.getBuffer().equals("exit"))
console.stop();
return 0;
}
};
console.setConsoleCallback(consoleCallback);
console.setPrompt(new Prompt("aesh@rules: "));
console.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment