package org.octabyte.fxshell;
import org.octabyte.fxshell.terminal.command.CommandProcessor;
/**
* @author kobylsa on 06/02/14.
*/
public class SampleTerminalRunner extends SimpleTerminal {
public SampleTerminalRunner() {
super(500, 300);
addCmdProcessor("blah", new CommandProcessor() {
@Override
public void onCommand(String cmd, String... cmdArgs) {
// line without prompt
getTermState().startNewLine("");
getTermState().setLastLineText("blah-blah-blah");
for(int i = 0; i != 10; ++i) {
getTermState().insertCharAtCursor('.');
try { Thread.sleep((int)(400 * Math.random())); } catch (Exception e) {
// ignore...
}
}
getTermState().insertStringAtCursor(" blah");
// line with prompt
getTermState().startNewLine();
}
});
}
public static void main(String... args) {
launch(args);
}
}