}
};
exampleConsole.addCompletion(completer);
ConsoleOutput line;
exampleConsole.pushToStdOut(ANSI.greenBackground());
//while ((line = exampleConsole.read(prompt)) != null) {
//while ((line = exampleConsole.read("[test@foo.bar]~> ")) != null) {
while ((line = exampleConsole.read(prompt, null)) != null) {
exampleConsole.pushToStdOut("======>\"" + line.getBuffer() + "\"\n");
if (line.getBuffer().equalsIgnoreCase("quit") || line.getBuffer().equalsIgnoreCase("exit") ||
line.getBuffer().equalsIgnoreCase("reset")) {
break;
}
if(line.getBuffer().equalsIgnoreCase("password")) {
line = exampleConsole.read(new Prompt("password: "), Character.valueOf((char) 0));
exampleConsole.pushToStdOut("password typed:" + line.getBuffer() + "\n");
}
//test stdErr
if(line.getBuffer().startsWith("blah")) {
exampleConsole.pushToStdErr("blah. command not found.\n");
}
if(line.getBuffer().equals("clear"))
exampleConsole.clear();
if(line.getBuffer().startsWith("man")) {
//exampleConsole.attachProcess(test);
test.attach(line);
}
}
if(line != null && line.getBuffer().equals("reset")) {
exampleConsole.stop();
exampleConsole = new Console();
while ((line = exampleConsole.read("> ")) != null) {
exampleConsole.pushToStdOut("======>\"" + line + "\"\n");
if (line.getBuffer().equalsIgnoreCase("quit") || line.getBuffer().equalsIgnoreCase("exit") ||
line.getBuffer().equalsIgnoreCase("reset")) {
break;
}
}
}