public Console create(CommandProcessor processor, InputStream in, PrintStream out, PrintStream err, final Terminal terminal,
String encoding, Runnable closeCallback) {
ConsoleImpl console = new ConsoleImpl(processor, in, out, err, terminal, encoding, closeCallback);
CommandSession session = console.getSession();
session.put("APPLICATION", System.getProperty("karaf.name", "root"));
session.put("#LINES", new Function() {
public Object execute(CommandSession session, List<Object> arguments) throws Exception {
return Integer.toString(terminal.getHeight());
}
});
session.put("#COLUMNS", new Function() {
public Object execute(CommandSession session, List<Object> arguments) throws Exception {
return Integer.toString(terminal.getWidth());
}
});
session.put(".jline.terminal", terminal);