public ProgressBar(long total) throws IOException { this.total = total; this.ctime = System.currentTimeMillis(); this.terminal = TerminalBuilder.terminal(); }
terminal = TerminalBuilder.terminal(); } catch (IOException e) { e.printStackTrace();
terminal = TerminalBuilder.terminal(); } catch (IOException e) { e.printStackTrace();
/** * Create a new renderer * @param vertx the current Vert.x instance * @return the renderer */ public static ImportProgressRenderer create(Vertx vertx) { // get capabilities of the terminal int terminalWidth; boolean dumb; try (Terminal terminal = TerminalBuilder.terminal()) { terminalWidth = terminal.getWidth(); dumb = Terminal.TYPE_DUMB.equalsIgnoreCase(terminal.getType()) || Terminal.TYPE_DUMB_COLOR.equalsIgnoreCase(terminal.getType()); } catch (IOException e) { terminalWidth = DEFAULT_TERMINAL_WIDTH; dumb = true; } if (terminalWidth < MIN_TERMINAL_WIDTH) { terminalWidth = DEFAULT_TERMINAL_WIDTH; } // determine refresh interval long interval; if (dumb) { interval = DEFAULT_INTERVAL_SLOW; } else { interval = DEFAULT_INTERVAL; } // create renderer return new ImportProgressRenderer(interval, terminalWidth, vertx); }
terminal = TerminalBuilder.terminal(); } catch (IOException e) { e.printStackTrace();
terminal = TerminalBuilder.terminal(); } catch (IOException e) { e.printStackTrace();
private void run(final SessionFactory sessionFactory, String command, final InputStream in, final PrintStream out, final PrintStream err, ClassLoader cl) throws Exception { try (org.jline.terminal.Terminal jlineTerminal = TerminalBuilder.terminal()) { final Terminal terminal = new JLineTerminal(jlineTerminal); try (Session session = createSession(sessionFactory, command.length() > 0 ? null : in, out, err, terminal)) { session.put("USER", user); session.put("APPLICATION", application); discoverCommands(session, cl, getDiscoveryResource()); if (command.length() > 0) { // Shell is directly executing a sub/command, we don't setup a console // in this case, this avoids us reading from stdin un-necessarily. session.put(NameScoping.MULTI_SCOPE_MODE_KEY, Boolean.toString(isMultiScopeMode())); session.put(Session.PRINT_STACK_TRACES, "execution"); try { session.execute(command); } catch (Throwable t) { ShellUtil.logException(session, t); } } else { // We are going into full blown interactive shell mode. session.run(); } } } }
if (terminal == null) { try { terminal = TerminalBuilder.terminal(); } catch (IOException e) { throw new IOError(e);
private void run(final SessionFactory sessionFactory, String command, final InputStream in, final PrintStream out, final PrintStream err, ClassLoader cl) throws Exception { try (org.jline.terminal.Terminal jlineTerminal = TerminalBuilder.terminal()) { final Terminal terminal = new JLineTerminal(jlineTerminal); try (Session session = createSession(sessionFactory, command.length() > 0 ? null : in, out, err, terminal)) { session.put("USER", user); session.put("APPLICATION", application); discoverCommands(session, cl, getDiscoveryResource()); if (command.length() > 0) { // Shell is directly executing a sub/command, we don't setup a console // in this case, this avoids us reading from stdin un-necessarily. session.put(NameScoping.MULTI_SCOPE_MODE_KEY, Boolean.toString(isMultiScopeMode())); session.put(Session.PRINT_STACK_TRACES, "execution"); try { session.execute(command); } catch (Throwable t) { ShellUtil.logException(session, t); } } else { // We are going into full blown interactive shell mode. session.run(); } } } }
terminal = TerminalBuilder.terminal(); } catch (IOException e) { e.printStackTrace();
terminal = TerminalBuilder.terminal(); } catch (IOException e) { e.printStackTrace();
"change_password", "list_principals", "get_principal"); Terminal terminal = TerminalBuilder.terminal(); LineReader lineReader = LineReaderBuilder.builder().completer(completer).terminal(terminal).build();