@Override protected ConsoleReader createConsoleReader() { ConsoleReader consoleReader = super.createConsoleReader(); consoleReader.setHistory(gfshHistory); terminal = consoleReader.getTerminal(); return consoleReader; }
consoleReader.setHistory(this.history); } else { consoleReader.setHistoryEnabled(false);
String historyFile = historyDirectory + File.separator + HISTORYFILE; history = new FileHistory(new File(historyFile)); reader.setHistory(history); } else { System.err.println("WARNING: Directory for Hive history file: " + historyDirectory +
public GreysConsole(InetSocketAddress address) throws IOException { this.console = initConsoleReader(); this.history = initHistory(); this.out = console.getOutput(); this.history.moveToEnd(); this.console.setHistoryEnabled(true); this.console.setHistory(history); this.console.setExpandEvents(false); this.socket = connect(address); // 关闭会话静默 disableSilentOfSession(); // 初始化自动补全 initCompleter(); this.isRunning = true; activeConsoleReader(); socketWriter.write("version\n"); socketWriter.flush(); loopForWriter(); }
/** * @param systemIn The system in * @param systemOut The system out * @param systemErr The system err * @throws IOException if there is an error */ protected void initialize(InputStream systemIn, PrintStream systemOut, PrintStream systemErr) throws IOException { bindSystemOutAndErr(systemOut, systemErr); redirectSystemOutAndErr(true); System.setProperty(ShutdownHooks.JLINE_SHUTDOWNHOOK, "false"); if (isInteractiveEnabled()) { reader = createConsoleReader(systemIn); reader.setBellEnabled(false); reader.setCompletionHandler(new CandidateListCompletionHandler()); if (isActivateTerminal()) { terminal = createTerminal(); } history = prepareHistory(); if (history != null) { reader.setHistory(history); } } else if (isActivateTerminal()) { terminal = createTerminal(); } }
private static void configureHistory(ConsoleReader reader) throws IOException { String homeFolder = System.getProperty("user.home"); File historyFile = new File(homeFolder, ".iclojure_history"); reader.setHistory(new FileHistory(historyFile)); reader.setHistoryEnabled(true); }
reader.setHistory(new FileHistory(new File(Configuration.getUserHome(), String.format(".jline-%s.%s.history", mainClass, historyFileName)))); reader.setHistory(new FileHistory(new File(Configuration.getUserHome(), String.format(".jline-%s.history", mainClass))));
@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); }
try { final FileHistory history = new FileHistory(new File(historyPath)); reader.setHistory(history);
@Override public void execute(String[] args, ConsoleReader reader) throws Exception { changingLogicalPlan = true; reader.setHistory(changingLogicalPlanHistory); }
@Override public void execute(String[] args, ConsoleReader reader) throws Exception { logicalPlanRequestQueue.clear(); changingLogicalPlan = false; reader.setHistory(topLevelHistory); }
private void setHistory() { try { final String HISTORYFILE = ".odps_history"; String historyFile = System.getProperty("user.home") + File.separator + HISTORYFILE; consoleReader.setHistory(new FileHistory(new File(historyFile))); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { ((FileHistory) consoleReader.getHistory()).flush(); } catch (IOException ex) { } } }); } catch (IOException e) { // ignore file history failure } }
private void initHistory() { try { String historyPath = HOME_DIR + File.separator + HISTORY_FILE; if ((new File(HOME_DIR)).exists()) { history = new TajoFileHistory(new File(historyPath)); history.setAutoTrim(false); history.setIgnoreDuplicates(false); reader.setHistory(history); } else { System.err.println(ERROR_PREFIX + "home directory : '" + HOME_DIR +"' does not exist."); } } catch (Exception e) { System.err.println(ERROR_PREFIX + e.getMessage()); } }
private void initHistory() { try { String historyPath = HOME_DIR + File.separator + HISTORY_FILE; if ((new File(HOME_DIR)).exists()) { history = new TajoFileHistory(new File(historyPath)); history.setAutoTrim(false); history.setIgnoreDuplicates(false); reader.setHistory(history); } else { System.err.println(ERROR_PREFIX + "home directory : '" + HOME_DIR +"' does not exist."); } } catch (Exception e) { System.err.println(ERROR_PREFIX + e.getMessage()); } }
@Override protected ConsoleReader createConsoleReader() { ConsoleReader consoleReader = super.createConsoleReader(); consoleReader.setHistory(gfshHistory); terminal = consoleReader.getTerminal(); return consoleReader; }
private void setupHistory(ConsoleReader reader) { File historyFile = new File(StramClientUtils.getUserDTDirectory(), "cli_history"); historyFile.getParentFile().mkdirs(); try { topLevelHistory = new FileHistory(historyFile); reader.setHistory(topLevelHistory); historyFile = new File(StramClientUtils.getUserDTDirectory(), "cli_history_clp"); changingLogicalPlanHistory = new FileHistory(historyFile); } catch (IOException ex) { System.err.printf("Unable to open %s for writing.", historyFile); } }
protected ConsoleReader createConsoleReaderWhithoutArgs(String enteredUserName) { ConsoleReader consoleReader = null; history = null; try { consoleReader = new ConsoleReader(); consoleReader.setPrompt(getPrompt()); history = new FileHistory(getHistoryFile(enteredUserName)); consoleReader.setHistory(history); } catch (IOException e) { throw new IllegalStateException("Cannot create jline console reader", e); } return consoleReader; }
public void start(int initialPort) throws Exception { ConsoleReader console = new ConsoleReader(); console.getTerminal().setEchoEnabled(false); console.setPrompt("\u001B[32menkan\u001B[0m> "); History history = new FileHistory(new File(System.getProperty("user.home"), ".enkan_history")); console.setHistory(history); CandidateListCompletionHandler handler = new CandidateListCompletionHandler(); console.setCompletionHandler(handler); consoleHandler = new ConsoleHandler(console); if (initialPort > 0) { consoleHandler.connect(initialPort); } clientThread.execute(consoleHandler); clientThread.shutdown(); }
public Terminal(Configuration configuration) { try { this.configuration = configuration; jline.TerminalFactory.configure("auto"); reader = new ConsoleReader(); reader.setHistory(new MemoryHistory()); reader.addCompleter(new ArgumentCompleter(selectCompleters())); } catch (IOException ex) { throw new RuntimeException(ex); } }
@Test public void testHistory() throws IOException{ ConsoleReader console= new ConsoleReader(); //History history= new History(new File(System.getProperty("user.home") + File.separator + ".asciigenome_history")); History history= new MemoryHistory(); history.add("foobar"); history.add("baz"); console.setHistory(history); System.out.println(console.getHistory()); console.close(); }