Refine search
/** * Creates the instance of Terminal used directly in MicronautConsole. Note that there is also another terminal * instance created implicitly inside of ConsoleReader. That instance is controlled by the jline.terminal system * property. * * @return the new {@link Terminal} */ protected Terminal createTerminal() { terminal = TerminalFactory.create(); if (isWindows()) { terminal.setEchoEnabled(true); } return terminal; }
public static Terminal getFlavor(final Flavor flavor) throws Exception { return getFlavor(flavor, null); }
public static synchronized Terminal get() { return get(null); }
public Boolean call() throws Exception { return TerminalFactory.get().isAnsiSupported(); } });
@Inject public JLine2Console(History history) throws Exception { super(); TerminalFactory.configure(Type.AUTO); terminal = TerminalFactory.get(); terminal.init(); consoleReader = new ConsoleReader(System.in, System.out, terminal); consoleReader.setHistory(history); consoleReader.setHistoryEnabled(true); }
context.attach(JMXManager.class); orderService.setTradingEnabled(true); Terminal terminal = TerminalFactory.get(); try { terminal.init(); } catch (Exception e) { throw new Error("Could not initialize terminal", e); terminal.setEchoEnabled(false);
public ConsoleReader(final @Nullable String appName, final InputStream in, final OutputStream out, final @Nullable Terminal term, final @Nullable String encoding) throws IOException { this.appName = appName != null ? appName : "JLine"; this.encoding = encoding != null ? encoding : Configuration.getEncoding(); Terminal terminal = term != null ? term : TerminalFactory.get(); this.terminal = terminal instanceof Terminal2 ? (Terminal2) terminal : new DefaultTerminal2(terminal); String outEncoding = terminal.getOutputEncoding() != null? terminal.getOutputEncoding() : this.encoding; this.out = new OutputStreamWriter(terminal.wrapOutIfNeeded(out), outEncoding); setInput( in ); this.inputrcUrl = getInputRc(); consoleKeys = new ConsoleKeys(this.appName, inputrcUrl); if (terminal instanceof UnixTerminal && TerminalLineSettings.DEFAULT_TTY.equals(((UnixTerminal) terminal).getSettings().getTtyDevice()) && Configuration.getBoolean("jline.sigcont", false)) { setupSigCont(); } }
private static ConsoleReader newConsoleReader(String programName) throws IOException { final boolean isWindows = isWindows(); final String type = System.getProperty(TerminalFactory.JLINE_TERMINAL); if (isWindows && type == null) { TerminalFactory.registerFlavor(TerminalFactory.Flavor.WINDOWS, UnsupportedTerminal.class); } else if (isWindows && type.equalsIgnoreCase(TerminalFactory.UNIX)) { TerminalFactory.registerFlavor(TerminalFactory.Flavor.UNIX, CygwinTerminal.class); } FileInputStream in = new FileInputStream(FileDescriptor.in); Terminal terminal = TerminalFactory.get(); ConsoleReader consoleReader = new ConsoleReader(programName, in, System.out, terminal, getDefaultEncoding()); consoleReader.setExpandEvents(false); return consoleReader; }
public static synchronized Terminal get(String ttyDevice) { // The code is assuming we've got only one terminal per process. // Continuing this assumption, if this terminal is already initialized, // we don't check if it's using the same tty line either. Both assumptions // are a bit crude. TODO: check single terminal assumption. if (term == null) { term = create(ttyDevice); } return term; }
public static synchronized void configure(final Type type) { checkNotNull(type); configure(type.name().toLowerCase()); }
public static void main(String[] args) { System.out.println("Tigon Distributed Client"); if (args.length > 0) { if ("--help".equals(args[0]) || "-h".equals(args[0])) { usage(false); return; } if (args.length < 2) { usage(true); } String zkQuorumString = args[0]; String rootNamespace = args[1]; DistributedMain main = null; try { main = createDistributedMain(zkQuorumString, rootNamespace); main.startUp(System.out); } catch (Exception e) { LOG.error(e.getMessage(), e); } finally { try { if (main != null) { main.shutDown(); } TerminalFactory.get().restore(); } catch (Exception e) { LOG.warn(e.getMessage(), e); } } } }
public Terminal getTerminal() { if (term == null) { term = TerminalFactory.get(); } return term; } //
/** * * @param color * @param string * @return */ public static String color(Color color, String string) { if (TerminalFactory.get().isAnsiSupported()) { return Ansi.ansi().fg(color).toString() + string + Ansi.ansi().fg(Color.DEFAULT); } else { return string; } }
public ConsoleReader(final @Nullable String appName, final InputStream in, final OutputStream out, final @Nullable Terminal term, final @Nullable String encoding) throws IOException { this.appName = appName != null ? appName : "JLine"; this.encoding = encoding != null ? encoding : Configuration.getEncoding(); Terminal terminal = term != null ? term : TerminalFactory.get(); this.terminal = terminal instanceof Terminal2 ? (Terminal2) terminal : new DefaultTerminal2(terminal); String outEncoding = terminal.getOutputEncoding() != null? terminal.getOutputEncoding() : this.encoding; this.out = new OutputStreamWriter(terminal.wrapOutIfNeeded(out), outEncoding); setInput( in ); this.inputrcUrl = getInputRc(); consoleKeys = new ConsoleKeys(this.appName, inputrcUrl); if (terminal instanceof UnixTerminal && TerminalLineSettings.DEFAULT_TTY.equals(((UnixTerminal) terminal).getSettings().getTtyDevice()) && Configuration.getBoolean("jline.sigcont", false)) { setupSigCont(); } }