org.codehaus.groovy.tools.shell.AnsiDetector Java Examples

The following examples show how to use org.codehaus.groovy.tools.shell.AnsiDetector. 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: GroovyInterpreter.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public GroovyInterpreter(Binding binding) throws IOException {
	this.binding = binding;
	if (this.binding == null)
		this.binding = new Binding();

	is = new PipedInputStream();
	os = new PipedOutputStream();
	pis = new PipedInputStream(os);
	pos = new PipedOutputStream(is);

	System.setProperty(TerminalFactory.JLINE_TERMINAL, "none");
	AnsiConsole.systemInstall();
	Ansi.setDetector(new AnsiDetector());

	binding.setProperty("out", new ImmediateFlushingPrintWriter(pos));

	shell = new Groovysh(binding, new IO(pis, pos, pos));
	// {
	// @Override
	// public void displayWelcomeBanner(InteractiveShellRunner runner) {
	// // do nothing
	// }
	// };
	shell.getIo().setVerbosity(Verbosity.QUIET);
}
 
Example #2
Source File: VertexiumShell.java    From vertexium with Apache License 2.0 5 votes vote down vote up
static void installAnsi() {
    // Install the system adapters, replaces System.out and System.err
    // Must be called before using IO(), because IO stores refs to System.out and System.err
    AnsiConsole.systemInstall();

    // Register jline ansi detector
    Ansi.setDetector(new AnsiDetector());
}
 
Example #3
Source File: JythonInterpreter.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public JythonInterpreter() throws IOException {
	is = new PipedInputStream();
	os = new PipedOutputStream();
	pis = new PipedInputStream(os);
	pos = new PipedOutputStream(is);

	System.setProperty(TerminalFactory.JLINE_TERMINAL, "none");
	AnsiConsole.systemInstall();
	Ansi.setDetector(new AnsiDetector());

	shell = new InteractiveConsole();
	shell.setIn(pis);
	shell.setOut(pos);
	shell.setErr(pos);
}