jline.console.history.History Java Examples
The following examples show how to use
jline.console.history.History.
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: ReplClient.java From enkan with Eclipse Public License 1.0 | 6 votes |
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(); }
Example #2
Source File: LineReader.java From sylph with Apache License 2.0 | 5 votes |
LineReader(History history, Completer... completers) throws IOException { setExpandEvents(false); setBellEnabled(true); setHandleUserInterrupt(true); setHistory(history); setHistoryEnabled(false); for (Completer completer : completers) { addCompleter(completer); } }
Example #3
Source File: CliConsoleTest.java From clamshell-cli with Apache License 2.0 | 5 votes |
@Test public void testAddToHistory() throws Exception{ History h = c.getReader().getHistory(); c.clearHistory(); c.addToHistory("Test"); Assert.assertEquals("Test", h.get(0)); }
Example #4
Source File: JLineConsole.java From elasticshell with Apache License 2.0 | 5 votes |
@Override public Iterator<CharSequence> getHistoryEntries() { if (fileHistory == null) { return new ArrayList<CharSequence>().iterator(); } return Iterators.transform(fileHistory.iterator(), new Function<History.Entry, CharSequence>() { @Override public CharSequence apply(jline.console.history.History.Entry entry) { return entry.value(); } }); }